Re: One to many query question

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: dave-ml(at)dribin(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: One to many query question
Date: 2003-07-31 07:42:48
Message-ID: 3F28C878.EE2EB806@rodos.fzk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.
>
It should be portable completely. It's SQL standard.
Regards, Christoph

Browse pgsql-sql by date

  From Date Subject
Next Message Christoph Haller 2003-07-31 08:00:07 Re: NEW and a subselect in a rule
Previous Message Bruce Momjian 2003-07-31 04:12:23 Re: TODO item for plpgsql Was Re: obtuse plpgsql function needs