RE: [SQL] finding rows in one table not in another

From: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
To: Brook Milligan <brook(at)trillium(dot)NMSU(dot)Edu>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: RE: [SQL] finding rows in one table not in another
Date: 1998-06-12 22:54:57
Message-ID: F10BB1FAF801D111829B0060971D839F2D7EFF@cpsmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message Edwin S. Ramirez 1998-06-13 21:22:42 (no subject)
Previous Message Brook Milligan 1998-06-12 22:50:14 Re: [SQL] finding rows in one table not in another