using EXISTS instead of IN: how?
| От | Rory Campbell-Lange |
|---|---|
| Тема | using EXISTS instead of IN: how? |
| Дата | |
| Msg-id | 20030722162845.GA2623@campbell-lange.net обсуждение исходный текст |
| Ответы |
Re: using EXISTS instead of IN: how?
Re: using EXISTS instead of IN: how? Re: using EXISTS instead of IN: how? |
| Список | pgsql-general |
I have been informed that at present (postgres 7.3.2) using IN is not
advised, and I should replace it with EXISTS. I can't seem to get it to
work.
I've tried replacing (example):
SELECT
name
FROM
people
WHERE
state IN (
SELECT
id
FROM
states
WHERE
name ~* 'r'
);
with
SELECT
name
FROM
people
WHERE
exists (
SELECT
1
FROM
states
WHERE
name ~* 'r'
);
However the second example simply finds all records in people.
Thanks for any help,
Rory
--
Rory Campbell-Lange
<rory@campbell-lange.net>
<www.campbell-lange.net>
В списке pgsql-general по дате отправления: