pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: dave-ml@dribin.org
To: pgsql-sql@postgresql.org
Subject: Re: One to many query question
Date: Thu, 31 Jul 2003 09:42:48 +0200
Message-ID: <3F28C878.EE2EB806@rodos.fzk.de> (raw)

>
> 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





view thread (10+ messages)

Message-ID: <3F28C878.EE2EB806@rodos.fzk.de>
Permalink:  ../3F28C878.EE2EB806@rodos.fzk.de/
Also on:    postgresql.org/message-id/3F28C878.EE2EB806@rodos.fzk.de

 · 

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: ch@rodos.fzk.de, dave-ml@dribin.org
  Subject: Re: One to many query question
  In-Reply-To: <3F28C878.EE2EB806@rodos.fzk.de>

* 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