full outer join question
Date: Wed, 20 Aug 2003 00:57:11 GMT
Message-ID: <HHz0b.203937$uu5.36905_at_sccrnsc04>
Hi
I have the following 4 tables and I need to do a fully outerjoin on them.
In oracle 9i, the following query returns correct results set, if I were to
join just 2 tables - A & B
select A.a, A.b, A.c, B.c
((A.a = B.a) and (A.b = B.b))
How do I extend this query to do a 4-way join ? Do you think the following
query would work or is there a simpler way ?
select A.a, A.b, A.c, B.c, C.c, D.c
((A.a=B.a)) and (A.b = B.b))
create table A (a number, b number, c char(10), primary key (a,b))
create table B (a number, b number, c char(10), primary key (a,b))
create table C (a number, b number, c char(10), priamry key (a,b))
create table D (a number, b number, c char(10), priamry key (a,b))
from A full outer join B on
from
A full outer join B on
full outer join C on
full outer join D on
((A.a = D.a) and (A.b = D.b)) OR ((B.a = D.a) and ((B.b =
D.b )) OR ((C.a = D.a) and (C.b = D.b))
((A.a = C.a) and (A.B = C.b)) OR ((B.a = C.a) and (B.b = C.b))
; Received on Wed Aug 20 2003 - 02:57:11 CEST