Re: [SQL] Left Join

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [SQL] Left Join
Дата
Msg-id Pine.LNX.4.21.0003051451020.347-100000@localhost.localdomain
обсуждение исходный текст
Ответ на Left Join  ("Nikolaj Lundsgaard" <Nikolaj@kampsax.dtu.dk>)
Список pgsql-sql
Nikolaj Lundsgaard writes:

> How do make a left join in postgresql ?

Outer joins aren't supported yet. You can generally do something like

select a2, b2 from a, b where a1 = b1 union
select a2, NULL from a where a1 not in (select b1 from b);

which is not very extensible to more than two tables. Alternatively you
can make a function that returns the corresponding value from b2 given an
a2 value, or some default if there isn't any corresponding one.

Look into the archives for outer joins for countless specifics on this.

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




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

Предыдущее
От: "Nikolaj Lundsgaard"
Дата:
Сообщение: Left Join
Следующее
От: Oleg Bartunov
Дата:
Сообщение: statistics using SQL