Is it This Join Condition Do-Able?

Поиск
Список
Период
Сортировка
От Lane Van Ingen
Тема Is it This Join Condition Do-Able?
Дата
Msg-id EKEMKEFLOMKDDLIALABIAEHJCBAA.lvaningen@esncc.com
обсуждение исходный текст
Ответы Re: Is it This Join Condition Do-Able?  (Michael Fuhr <mike@fuhr.org>)
Re: Is it This Join Condition Do-Able?  (Jeremy Semeiks <jrs@farviolet.com>)
Список pgsql-sql
Given three tables: a, b, c ; each consist of a 'keyfld' and a field called
'foo':    tbl a       tbl b         tbl c  ---------   ---------     ---------  a.keyfld    b.keyfld       c.keyfld
a.foo1     b.foo2         c.foo3
 

I want to always return all of tbl a; and I want to return b.foo2 and c.foo3
if
they can be joined to based on keyfld.a; I know that it will involve a LEFT
OUTER
JOIN on table a, but have not seen any examples of joins like this on 3 or
more
tables.

select a.keyfld, a.foo1, b.foo2, c.foo3
from a, b, c
where a.keyfld = <some value>
and   a.keyfld = b.keyfld
and   a.keyfld = c.keyfld;

Results could look like this: a.keyfld  a.foo1   b.foo2  c.foo3   xxxx     xxxx     xxxx    (null)   xxxx     xxxx
(null)   xxxx   xxxx     xxxx    (null)   (null)   xxxx     xxxx     xxxx     xxxx
 




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

Предыдущее
От: Frank Bax
Дата:
Сообщение: Re: [despammed] converting varchar to integer
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Is it This Join Condition Do-Able?