Re: [GENERAL] why isn't this subquery wrong?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] why isn't this subquery wrong?
Дата
Msg-id CAKFQuwY4o3G323LtKe_NWjBA+TEE99J01=w17vcdEcB=yZwOXA@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] why isn't this subquery wrong?  (jonathan vanasco <postgres@2xlp.com>)
Список pgsql-general
On Thu, Apr 20, 2017 at 3:17 PM, jonathan vanasco <postgres@2xlp.com> wrote:

SELECT foo_id
FROM example_a__data
WHERE foo_id IN (SELECT bar_id FROM example_a__rollup)
;


​Or write it the idiomatic way (i.e., as a proper semi-join):

​SELECT foo_id
FROM example_a__data
WHERE EXISTS (SELECT 1 
                                 FROM example_a__rollup
                              WHERE example_a__rollup.bar_id = example_a__data.foo_id)

IME its harder to forget the table prefix when using this form.

David J.

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

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: [GENERAL] why isn't this subquery wrong?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] why isn't this subquery wrong?