Re: Double query

Поиск
Список
Период
Сортировка
От D'Arcy J.M. Cain
Тема Re: Double query
Дата
Msg-id 20080206161710.0589ab6a.darcy@druid.net
обсуждение исходный текст
Ответ на Double query  (PostgreSQL Admin <postgres@productivitymedia.com>)
Список pgsql-sql
On Wed, 06 Feb 2008 16:01:09 -0500
PostgreSQL Admin <postgres@productivitymedia.com> wrote:
> 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.

I'm not sure what you mean by "first" and "second" but if you mean that
you want a list of all clinics that match the clinic ID and you want to
know of all of those which ones have the specified date then perhaps
this is what you want.
 SELECT id, date = '%s' FROM schedule WHERE clinic_id = '%s';

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


В списке pgsql-sql по дате отправления:

Предыдущее
От: johnf
Дата:
Сообщение: Information schema permissions
Следующее
От: Tom Hart
Дата:
Сообщение: outer join issues