X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 671AD475EDF for ; Wed, 14 May 2003 13:36:22 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 09797-06 for ; Wed, 14 May 2003 13:36:21 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 0FE76475A4B for ; Wed, 14 May 2003 13:36:21 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id D7BD543A611; Wed, 14 May 2003 13:36:20 -0400 (EDT) From: dave_h4@yahoo.com (Hunter) X-Newsgroups: comp.databases.postgresql.sql Subject: Left Join 3 tables Date: 14 May 2003 10:35:19 -0700 Organization: http://groups.google.com/ Lines: 25 Message-ID: <27ad91d2.0305140935.4fdec226@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/320 X-Sequence-Number: 13485 Hi Group - 1) I have 3 tables: A, B and C 2) Each table has an unqiue associative field called cust_id 3) The cust_id HAS to be in table A, the cust_id *could* be in table B, and the cust_id *could* be in table C 4) I need my query to: a) count all rows where cust_id is in table A but *not* in table B AND *not* in table C b) display all emails where cust_id is in table A but *not* in table B AND *not* in table C Here's some of my queries of what I have: This one is close I think: select distinct A.email from A left join A as ics on ics.custid = A.custid left join B on B.custid = A.custid left join C on C.custid = A.custid where ics.custid <> A.custid; THANK YOU! dave