Re: Full Outer Joins

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Full Outer Joins
Дата
Msg-id 20353.1022526156@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Full Outer Joins  (John Taylor <postgres@jtresponse.co.uk>)
Ответы Re: Full Outer Joins  (John Taylor <postgres@jtresponse.co.uk>)
Список pgsql-novice
John Taylor <postgres@jtresponse.co.uk> writes:
> I can do it all like this:

> SELECT stock,stockitems.description,o.ordercurrent,s.quantity FROM
> (SELECT stock,ordercurrent FROM orderlines o WHERE  o.theorder='  4494' AND (o.type='P' OR o.type='T')) AS o
> FULL OUTER JOIN
> (SELECT stock,quantity FROM standingorders s WHERE s.account=' 15048' AND s.dayno=2) AS s
> USING (stock)
> JOIN stockitems USING (stock)

If that actually has the behavior you want, then that's the way you
write it.  Placing restrictions inside an outer join is not semantically
the same as placing them outside (at the WHERE clause), so it wasn't
clear to me exactly what you wanted.

> How do I do it without the subselects ?

Why worry?  It looks like it should be an efficient solution, or at
least as efficient as you'll get.

            regards, tom lane

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

Предыдущее
От: John Taylor
Дата:
Сообщение: Re: Full Outer Joins
Следующее
От: John Taylor
Дата:
Сообщение: Re: Full Outer Joins