X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9D63432A2E6 for ; Fri, 8 Oct 2004 14:06:51 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08832-06 for ; Fri, 8 Oct 2004 13:06:37 +0000 (GMT) Received: from bcbssc.com (mail1.bcbssc.com [207.19.198.69]) by svr1.postgresql.org (Postfix) with ESMTP id 9446632A7E5 for ; Fri, 8 Oct 2004 14:06:39 +0100 (BST) Received: from ([207.19.198.73]) by mail1.bcbssc.com with ESMTP id KP-TRPV8.3780530; Fri, 08 Oct 2004 09:05:11 -0400 X-Internal-ID: 41576E4800010FA2 Received: from companiongroup.com (207.19.198.73) by companion1.companiongroup.com (NPlex 2.0.108); 8 Oct 2004 09:06:14 -0400 Message-ID: Date: Fri, 8 Oct 2004 09:02:00 -0400 From: "CHRIS HOOVER" To: sad@bankir.ru Cc: Thomas F O'Connell , pgsql-sql@postgresql.org, mmurrain@dbdes.com Subject: Re: help on a query X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/48 X-Sequence-Number: 19151 Just curious, what is wrong with the first way of coding the solution? ------------------( Forwarded letter 1 follows )--------------------- Date: Fri, 8 Oct 2004 08:44:23 +0400 To: Thomas.F.O'Connell[tfo]@sitening.com.comp, mmurrain@dbdes.com.comp Cc: pgsql-sql@postgresql.org.comp From: sad@bankir.ru.comp Sender: pgsql-sql-owner+m19150@postgresql.org.comp Subject: Re: [SQL] help on a query On Friday 08 October 2004 07:10, Thomas F.O'Connell wrote: > A query that should get the job done is: > > SELECT registration_id > FROM registrations r > WHERE NOT EXISTS ( > SELECT 1 > FROM receipts > WHERE registration_id = r.registration_id > ); Don't, PLEASE, don't !!! drive this way : SELECT r.registration_id FROM registrations AS r LEFT OUTER JOIN receipts AS rec ON rec.registration_id = r.registration_id WHERE rec.registration_id IS NULL; ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org