pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: CHRIS HOOVER <CHRIS.HOOVER@companiongroup.com>
Cc: sad@bankir.ru, "Thomas F O'Connell" <tfo@sitening.com>
Cc: pgsql-sql@postgresql.org
Cc: mmurrain@dbdes.com
Subject: Re: help on a query
Date: Fri, 8 Oct 2004 16:03:34 +0300 (EEST)
Message-ID: <Pine.LNX.4.44.0410081559340.12604-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <NYe01121-06b74e7b@companiongroup.com>

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




view thread (8+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0410081559340.12604-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0410081559340.12604-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0410081559340.12604-100000@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: achill@matrix.gatewaynet.com, CHRIS.HOOVER@companiongroup.com, tfo@sitening.com, mmurrain@dbdes.com
  Subject: Re: help on a query
  In-Reply-To: <Pine.LNX.4.44.0410081559340.12604-100000@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox