Date: Wed, 6 Mar 2002 10:27:05 +1000
Reply-To: Philip_Crane@WORKCOVER.VIC.GOV.AU
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Philip_Crane@WORKCOVER.VIC.GOV.AU
Subject: Re: SQL logic
Content-type: text/plain; charset=us-ascii
Peter
The restriction of only two tables in a left join is prescribed in the SQL
standard. SAS as you have seen implements the standard and uses the standard
syntax. Oracle has its own extensions that remove the limit of two and they use
their own syntax. So in Oracle you can say
select a.*,
b.extra_from_b,
c.extra_from_c
from tab_a a,
tab_b b,
tab_c c
where a.key = b.key(+)
and a.key = c.key(+)
Which will select all rows from tab_a and add columns from tab_b and tab_c when
the key exists. When tab_b and tab_c do not contribute columns extra_from_b,c
will be null.
Be careful not to confuse the two different syntaxes. From within SAS code the
Oracle code can only be included as pass thru SQL.
Hope this helps get you started.
Philip