Re: Full Outer Joins

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Taylor <postgres(at)jtresponse(dot)co(dot)uk>
Cc: "Joel Burton" <joel(at)joelburton(dot)com>, "PgSQL Novice ML" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Full Outer Joins
Date: 2002-05-27 19:02:36
Message-ID: 20353.1022526156@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

John Taylor <postgres(at)jtresponse(dot)co(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John Taylor 2002-05-27 19:05:07 Re: Full Outer Joins
Previous Message John Taylor 2002-05-27 18:31:37 Re: Full Outer Joins