X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 581069DCC67 for ; Wed, 8 Feb 2006 17:15:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55261-04 for ; Wed, 8 Feb 2006 17:15:05 -0400 (AST) X-Greylist: delayed 00:05:01.528835 by SQLgrey- Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [204.127.192.82]) by postgresql.org (Postfix) with ESMTP id AF18A9DCABB for ; Wed, 8 Feb 2006 17:15:02 -0400 (AST) Received: from [10.0.1.5] (c-24-20-199-254.hsd1.or.comcast.net[24.20.199.254]) by comcast.net (rwcrmhc12) with SMTP id <20060208211002m120001dtie>; Wed, 8 Feb 2006 21:10:02 +0000 Subject: Non Matching Records in Two Tables From: Ken Hill Reply-To: ken@scottshill.com To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary="=-Y1cYpEHeuRYV0Vowj8Mt" Organization: Scotts Hill Associates, Inc. Date: Wed, 08 Feb 2006 13:10:23 -0800 Message-Id: <1139433024.2044.48.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.024 required=5 tests=[AWL=0.023, HTML_MESSAGE=0.001] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200602/83 X-Sequence-Number: 24093 --=-Y1cYpEHeuRYV0Vowj8Mt Content-Type: text/plain Content-Transfer-Encoding: 7bit I need some help with a bit of SQL. I have two tables. I want to find records in one table that don't match records in another table based on a common column in the two tables. Both tables have a column named 'key100'. I was trying something like: SELECT count(*) FROM table1, table2 WHERE (table1.key100 != table2.key100); But the query is very slow and I finally just cancel it. Any help is very much appreciated. -Ken --=-Y1cYpEHeuRYV0Vowj8Mt Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit I need some help with a bit of SQL. I have two tables. I want to find records in one table that don't match records in another table based on a common column in the two tables. Both tables have a column named 'key100'. I was trying something like:

SELECT count(*)
FROM table1, table2
WHERE (table1.key100 != table2.key100);

But the query is very slow and I finally just cancel it. Any help is very much appreciated.

-Ken --=-Y1cYpEHeuRYV0Vowj8Mt--