Received: from bjke.com (firewall-user@ganymede.bjke.com [144.210.8.38]) by hub.org (8.8.8/8.7.5) with ESMTP id SAA26495 for ; Fri, 12 Jun 1998 18:54:47 -0400 (EDT) Received: by bjke.com; id SAA22379; Fri, 12 Jun 1998 18:52:13 -0400 (EDT) Received: from cpsmail.cpsgroup.com(144.210.12.11) by gauntlet.bjke.com via smap (3.2) id xmaa22247; Fri, 12 Jun 98 18:51:53 -0400 Received: by cpsmail with Internet Mail Service (5.0.1458.49) id ; Fri, 12 Jun 1998 17:55:00 -0500 Message-ID: From: "Jackson, DeJuan" To: Brook Milligan 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 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1458.49) Content-Type: text/plain > > 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