Received: from openmail.kick.com (adsl-63-205-173-34.dsl.snfc21.pacbell.net [63.205.173.34]) by hub.org (8.10.1/8.10.1) with ESMTP id e6B0j9W82381 for ; Mon, 10 Jul 2000 20:45:09 -0400 (EDT) Received: from planetblargh (adsl-63-205-173-36.dsl.snfc21.pacbell.net [63.205.173.36]) by openmail.kick.com (8.9.3/8.9.3) with SMTP id RAA23836; Mon, 10 Jul 2000 17:44:32 -0700 Message-ID: <01fc01bfead0$fcdd1e30$0c64010a@kick.com> From: "Stephan Szabo" To: "Zot O'Connor" Cc: References: <396A6A7B.39CC7772@zotconsulting.com> Subject: Re: Finding entries not in table..differnce? Date: Mon, 10 Jul 2000 17:43:10 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200007/113 Assuming that you don't have nulls in prodlang.prodlsku, this should probably work, although I haven't tried it for real. SELECT prodlang.prodlsku FROM prodlang WHERE NOT EXISTS (SELECT * FROM prodlang2 WHERE prodlang2.prodlsku=prodlang.prodlsku); If you do have nulls, the inner select probably needs to be something like: (SELECT * FROM prodlang2 WHERE prodlang2.prodlsku=prodlang.prodlsku or (prodlang2.prodlsku is null and prodlang.prodlsku is null)) ----- Original Message ----- From: "Zot O'Connor" To: "postgres sql" Sent: Monday, July 10, 2000 5:29 PM Subject: [SQL] Finding entries not in table..differnce? > I need to write a quick function that tells me all of the entriles in > table that are not in table2. > > The tables are copies of each other, but 1 has been updated. I know > this is easy, but I am running on little sleep :) > > I want to due something like > > select prodlang.prodlsku from prodland,prodlang2 WHERE prodlang.prodlsku > != prodlang2.prodlsku > > But of course I would get every record, several times since at some > point the sku does not equal another sku. > > I tried !!= (NOT IN) but it did not like that at all, since sku is a > char field. > > I am running an older version of postgress on this server, I do not know > if that is important.