pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PostgreSQL Admin <postgres@productivitymedia.com>
To: pgsql-sql@postgresql.org
Subject: Double query
Date: Wed, 06 Feb 2008 16:01:09 -0500
Message-ID: <47AA2015.2060506@productivitymedia.com> (raw)
In-Reply-To: <87tzkvbfr6.fsf@oxford.xeocode.com>
References: <aa457f86948348248e93c6fc38b4b1f6@pobox.sk>
	<20080130104226.GF26490@a-kretschmer.de>
	<87tzkvbfr6.fsf@oxford.xeocode.com>

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



view thread (2+ messages)  latest in thread

Message-ID: <47AA2015.2060506@productivitymedia.com>
Permalink:  ../47AA2015.2060506@productivitymedia.com/
Also on:    postgresql.org/message-id/47AA2015.2060506@productivitymedia.com

 · 

reply

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: postgres@productivitymedia.com
  Subject: Re: Double query
  In-Reply-To: <47AA2015.2060506@productivitymedia.com>

* 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