Re: Full Outer Joins - Mailing list pgsql-novice

From Tom Lane
Subject Re: Full Outer Joins
Date
Msg-id 20353.1022526156@sss.pgh.pa.us
Whole thread Raw
In response to Re: Full Outer Joins  (John Taylor <postgres@jtresponse.co.uk>)
Responses Re: Full Outer Joins
List 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 by date:

Previous
From: John Taylor
Date:
Subject: Re: Full Outer Joins
Next
From: John Taylor
Date:
Subject: Re: Full Outer Joins