Re: Looking for the correct solution for a generic problem.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Looking for the correct solution for a generic problem.
Дата
Msg-id 18832.1013118653@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Looking for the correct solution for a generic problem.  (Frank Joerdens <frank@joerdens.de>)
Список pgsql-sql
Frank Joerdens <frank@joerdens.de> writes:
> This works fine if there is *at least* one row in B for each row in A.
> If there isn't, I obviously get 0 results even if the column foo in A
> matches the desired criteria. But I do want the rows from A even if
> there is no row in B that is linked to those rows in A that match the
> criteria.

You want an "outer join".  Something likeFROM A LEFT JOIN B ON (A.id = B.a_id)WHERE [other criteria]
        regards, tom lane


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Looking for the correct solution for a generic problem.
Следующее
От: Frank Joerdens
Дата:
Сообщение: Re: Looking for the correct solution for a generic problem.