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 QAA13313 for ; Fri, 12 Jun 1998 16:58:24 -0400 (EDT) Received: by bjke.com; id QAA13370; Fri, 12 Jun 1998 16:55:48 -0400 (EDT) Received: from cpsmail.cpsgroup.com(144.210.12.11) by gauntlet.bjke.com via smap (3.2) id xmaa12404; Fri, 12 Jun 98 16:54:49 -0400 Received: by cpsmail with Internet Mail Service (5.0.1458.49) id ; Fri, 12 Jun 1998 15:57:55 -0500 Message-ID: From: "Jackson, DeJuan" To: Brook Milligan , pgsql-sql@postgreSQL.org Subject: RE: [SQL] finding rows in one table not in another Date: Fri, 12 Jun 1998 15:57:54 -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); > > However, this revealed no rows, even though I know of instances where > id from mytable1 is absent from id in mytable2. Is there some other > way to do this? Am I missing something? Is there a workaround? > > Cheers, > Brook > try: SELECT mytable1.id FROM mytable1 WHERE NOT EXIST (SELECT mytable2.id FROM mytable2 WHERE mytable1.id = mytable2.id); -DEJ