Re: One to many query question - Mailing list pgsql-sql

From Dave Dribin
Subject Re: One to many query question
Date
Msg-id 20030730223306.GG1383@neo.realtors.org
Whole thread Raw
In response to Re: One to many query question  (Dmitry Tkach <dmitry@openratings.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Eric Clark
Date:
Subject: Re: One to many query question
Next
From: "2000info"
Date:
Subject: Unsubscribe