From: Jackson, DeJuan <djackson@cpsgroup.com>
To: Brook Milligan <brook@trillium.NMSU.Edu>
Cc: pgsql-sql@postgreSQL.org
Subject: RE: [SQL] finding rows in one table not in another
Date: Fri, 12 Jun 1998 17:54:57 -0500
Message-ID: <F10BB1FAF801D111829B0060971D839F2D7EFF@cpsmail> (raw)
> > I need to find the set of rows in one table that are not in
> another
> > table. I used a query like the following:
> >
> > select distinct id from mytable1 where id not in (select
> > distinct id from mytable2);
> >
> try:
> SELECT mytable1.id
> FROM mytable1
> WHERE NOT EXIST (SELECT mytable2.id
> FROM mytable2
> WHERE mytable1.id = mytable2.id);
>
> Thanks. That works except it should be EXISTS (i.e., plural).
Yeah. Sorry for the typo.
> Cheers,
> Brook
-DEJ
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: djackson@cpsgroup.com, brook@trillium.NMSU.Edu
Subject: Re: [SQL] finding rows in one table not in another
In-Reply-To: <F10BB1FAF801D111829B0060971D839F2D7EFF@cpsmail>
References: <F10BB1FAF801D111829B0060971D839F2D7EFF@cpsmail>
* 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