Left joins

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Left joins
Дата
Msg-id Pine.LNX.4.10.9907121420210.4521-100000@saxony.pathwaynet.com
обсуждение исходный текст
Список pgsql-sql
Does anyone know an elegant way of doing a left join like

Table 1
abc    1
def    2
ghi    <NULL>

Table 2
1    foo
2    bar
3    duh

I'd like to join those to give me:
abc    1    foo
def    2    bar
ghi    <NULL>    <NULL>

I can currently only envision a way to do this via a union of several
queries filtering out null and non-null fields, but that gets very
cumbersome when you have lots of fields involved and more than two or
three tables to join.

Any suggestions?

Thanks.

-- 
Peter Eisentraut
PathWay Computing, Inc.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] calculating percentages
Следующее
От: Heinz Hemken
Дата:
Сообщение: variables in pgSQL?