Re: self join

Поиск
Список
Период
Сортировка
От Seb
Тема Re: self join
Дата
Msg-id 87tycwsxsk.fsf@kolob.subpolar.dyndns.org
обсуждение исходный текст
Ответ на self join  (Seb <spluque@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Ian Lawrence Barwick
Дата:
Сообщение: Re: self join
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: self join