Subquery with IN or EXISTS

Поиск
Список
Период
Сортировка
От anssiman@my-deja.com (A. Mannisto)
Тема Subquery with IN or EXISTS
Дата
Msg-id 8b9752ea.0109260624.5b0d2c20@posting.google.com
обсуждение исходный текст
Список pgsql-sql
Hello,

does anybody know why this:
SELECT * FROM tab WHERE col1 IN (SELECT col2 FROM TAB2)

equals this:
SELECT * FROM tab WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 =
col2)

but this:
SELECT * FROM tab WHERE col1 IN (SELECT col2 FROM TAB2 WHERE
col3='huu')

equals _NOT_ this:
SELECT * FROM tab WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 =
col2 AND col3='huu')

E.g. resultset is not the same in last two statements.
Can I get same set as IN statement somehow using EXISTS (performance
issue)?


В списке pgsql-sql по дате отправления:

Предыдущее
От: Andy Hibbins
Дата:
Сообщение: Re: getting some tech skills?
Следующее
От: Rick Robino
Дата:
Сообщение: Re: Request for book reviews/comments