Double query

From: PostgreSQL Admin <postgres(at)productivitymedia(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Double query
Date: 2008-02-06 21:01:09
Message-ID: 47AA2015.2060506@productivitymedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Simple question - but my brain is not working:

This is my table
Column | Type |
Modifiers
-----------+------------------------+-----------------------------------------------------------------
id | integer | not null default
nextval('emr_clinicschedule_id_seq'::regclass)
clinic_id | integer | not null
date | date |
day | smallint |
status | boolean | not null
open | time without time zone |
close | time without time zone |
reason | character varying(64) |
active | boolean | not null

I want to find any value:

SELECT id FROM schedule WHERE clinic_id = '%s' AND date = '%s'

But I want to make sure the clinic exist first then find if the date
exist 2nd.

How do I do that?

Thanks in advance,
J

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message johnf 2008-02-06 21:01:35 Information schema permissions
Previous Message Thomas Kellerer 2008-02-06 20:43:44 Re: Columns view? (Finding column names for a table)