Apparently I don't understand full outer joins....

Поиск
Список
Период
Сортировка
Искать
От
Ben
Тема
Apparently I don't understand full outer joins....
Дата
Msg-id
Pine.LNX.4.44.0501251226110.9786-100000@localhost.localdomain
Список
Дерево обсуждения
Apparently I don't understand full outer joins.... Ben <bench@silentmedia.com>
Re: Apparently I don't understand full outer joins.... Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: Apparently I don't understand full outer joins.... Ben <bench@silentmedia.com>
Re: Apparently I don't understand full outer joins.... Richard Poole <rp@guests.deus.net>
Re: Apparently I don't understand full outer joins.... Thomas F.O'Connell <tfo@sitening.com>
I run this:

select
	coalesce(a.n,0) as a,
	coalesce(b.n,0) as b,
	coalesce(a.s,b.s) as s
from
	( select 1 as n, 0 as s) a full outer join
	( select 2 as n, 1 as s) b
on
	a.s = b.s

... and get this:

a | b | s
---+---+---
 1 | 0 | 0
 0 | 2 | 1
(2 rows)


Perfect! Now, I try to extend my understanding to 3 subselects:

select
	coalesce(a.n,0) as a,
	coalesce(b.n,0) as b,
	coalesce(c.n,0) as c,
	coalesce(a.s,b.s,c.s) as s
from
	( select 1 as n, 0 as s) a full outer join
	( select 1 as n, 1 as s) b full outer join
	( select 2 as n, 2 as s) c
on
	a.s = b.s and
	b.s = c.s


.... and get a syntax error at the end of my query. Apparently what I'm 
trying to do doesn't make sense?

Oh, this is on version 7.4, if that makes a difference.


---
Ben Chobot
Senior Technical Specialist, Washington Mutual
206-461-4005



В списке pgsql-general по дате отправления
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Extended unit
От: Thomas F.O'Connell
Дата:
FAQ