On Sun, 15 May 2011 07:39:06 +0900, Ian Lawrence Barwick <barw...@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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql