From: D'Arcy J.M. Cain <darcy@druid.net>
To: PostgreSQL Admin <postgres@productivitymedia.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Double query
Date: Wed, 6 Feb 2008 16:17:10 -0500
Message-ID: <20080206161710.0589ab6a.darcy@druid.net> (raw)
In-Reply-To: <47AA2015.2060506@productivitymedia.com>
References: <aa457f86948348248e93c6fc38b4b1f6@pobox.sk>
<20080130104226.GF26490@a-kretschmer.de>
<87tzkvbfr6.fsf@oxford.xeocode.com>
<47AA2015.2060506@productivitymedia.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: darcy@druid.net, postgres@productivitymedia.com
Subject: Re: Double query
In-Reply-To: <20080206161710.0589ab6a.darcy@druid.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox