Re: help on a query - Mailing list pgsql-sql

From Thomas F.O'Connell
Subject Re: help on a query
Date
Msg-id B26D13E6-193B-11D9-936A-000D93AE0944@sitening.com
Whole thread Raw
In response to Re: help on a query  ("CHRIS HOOVER" <CHRIS.HOOVER@companiongroup.com>)
Responses Re: help on a query
List pgsql-sql
I think the OUTER JOIN version is probably more efficient, but EXPLAIN 
would tell you.

-tfo

On Oct 8, 2004, at 8:02 AM, CHRIS HOOVER wrote:

> 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;



pgsql-sql by date:

Previous
From: Achilleus Mantzios
Date:
Subject: Re: help on a query
Next
From: Michelle Murrain
Date:
Subject: Re: help on a query