From: Dave Dribin <dave-ml@dribin.org>
To: pgsql-sql@postgresql.org
Subject: Re: One to many query question
Date: Wed, 30 Jul 2003 17:33:06 -0500
Message-ID: <20030730223306.GG1383@neo.realtors.org> (raw)
In-Reply-To: <3F2837FF.7020805@openratings.com>
References: <20030730193517.GB1383@neo.realtors.org>
<3F2837FF.7020805@openratings.com>
On Wed, Jul 30, 2003 at 05:26:23PM -0400, Dmitry Tkach wrote:
> >How do I write a query to find all CDs that are NOT Rock?
> >
> What about
> select * from cd where not exists (select 1 from cd_genres where cd_id
> = cd.id and genre='Rock')?
Thanks everyone! This did indeed work, and it does seem clearer. I
never knew about EXISTS before. How portable is this? I'm interested
in supporting PostgreSQL and MS SQL Server for now, and possibly
Oracle and MySQL in the future.
-Dave
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: dave-ml@dribin.org
Subject: Re: One to many query question
In-Reply-To: <20030730223306.GG1383@neo.realtors.org>
* 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