Re: self join - Mailing list pgsql-sql

From Seb
Subject Re: self join
Date
Msg-id 87tycwsxsk.fsf@kolob.subpolar.dyndns.org
Whole thread Raw
In response to self join  (Seb <spluque@gmail.com>)
List pgsql-sql
On Sun, 15 May 2011 07:39:06 +0900,
Ian Lawrence Barwick <barwick@gmail.com> wrote:

[...]

> Your query doesn't have an explicit join and is producing a cartesian
> result.

> I don't think a self- join will work here; a subquery should produce
> the result you're after:

> SELECT * FROM tmp t1 WHERE NOT EXISTS(SELECT TRUE FROM tmp t2 WHERE
> t2.b=t1.a);

This produces exactly the result I'm after.  I'll need to understand the
EXISTS statement there in more detail.

Thanks!

-- 
Seb



pgsql-sql by date:

Previous
From: Ian Lawrence Barwick
Date:
Subject: Re: self join
Next
From: Jasen Betts
Date:
Subject: Re: self join