pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Patrick Hatcher <PHatcher@macys.com>
To: pgsql-sql@postgresql.org
Subject: What is Syntax for multiple FULL OUTER JOINS?
Date: Tue, 19 Mar 2002 19:28:20 -0800
Message-ID: <OF73139E9C.959B1D5B-ON88256B82.00125A5D@fds.com> (raw)

Is it possible to do a full outer join on 3 or more queries?  I figured out
how to do 2, but I get an error message when trying to do three


Example:

(works)
select coalesce(a.f1, b.f1) as col_1, b.f2 as col_2
from
 (select f1, f2 from table1 where f3 =1) a
FULL OUTER JOIN
 (select f1, f2 from table1 where f3 =2) b
on a.f1 = b.f1

(does not work)
select coalesce(a.f1, b.f1,c.f1) as col_1, b.f2 as col_2, c.f2 as col_3
from
 (select f1, f2 from table1 where f3 =1) a
FULL OUTER JOIN
 (select f1, f2 from table1 where f3 =2) b
FULL OUTER JOIN
 (select f1, f2 from table1 where f3 =3) c
on a.f1 = b.f1and a.f1 = c.f1


TIA

Patrick Hatcher
Macys.Com
Legacy Integration Developer
415-932-0610 office
HatcherPT - AIM






view thread (3+ messages)  latest in thread

Message-ID: <OF73139E9C.959B1D5B-ON88256B82.00125A5D@fds.com>
Permalink:  ../OF73139E9C.959B1D5B-ON88256B82.00125A5D@fds.com/
Also on:    postgresql.org/message-id/OF73139E9C.959B1D5B-ON88256B82.00125A5D@fds.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: PHatcher@macys.com
  Subject: Re: What is Syntax for multiple FULL OUTER JOINS?
  In-Reply-To: <OF73139E9C.959B1D5B-ON88256B82.00125A5D@fds.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox