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 0C4C532A7A3 for ; Fri, 8 Oct 2004 14:48:04 +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 22476-07 for ; Fri, 8 Oct 2004 13:47:53 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 228FD32A79E for ; Fri, 8 Oct 2004 14:47:54 +0100 (BST) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id i98D3YCC013216; Fri, 8 Oct 2004 16:03:34 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id i98D3Y4b013212; Fri, 8 Oct 2004 16:03:34 +0300 Date: Fri, 8 Oct 2004 16:03:34 +0300 (EEST) From: Achilleus Mantzios To: CHRIS HOOVER Cc: sad@bankir.ru, "Thomas F O'Connell" , , Subject: Re: help on a query In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT 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/49 X-Sequence-Number: 19152 O CHRIS HOOVER έγραψε στις Oct 8, 2004 : > 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; Some one could add the same dont please dont, and advise: select registration_id FROM registrations where registration_id not in (select registration_id from receipts); but its actually version/data dependent i suppose. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- -Achilleus