|
|||
|
I am studying the e-learning course for the SAS Advanced certification, and
in a lesson it says about Creating an Inner Join with Outer Join-Style Syntax : ------ "General form, SELECT statement for inner join (alternate syntax): SELECT column-1<,...column-n> FROM table-1 | view-1 INNER JOIN table-2 | view-2 ON join-condition(s) <other clauses>; An inner join that uses this syntax can be performed on only two tables or views at a time. When an inner join uses the syntax presented earlier, up to 32 tables or views can be combined at once. In-line views are covered later in this lesson." ----- I wonder what this means - "only two tables at a time". In the code example below, *three* tables are joined together using the inner join syntax: data one; input x1 $ 1 a $ 3; datalines; 1 a 2 b 4 d ; data two; input x2 $ 1 b $ 3; datalines; 2 x 3 y 5 v ; data three; input x3 $ 1 c $ 3; datalines; 2 r 5 s ; proc sql; create table inner_join as select * from one inner join two on one.x1 = two.x2 inner join three on two.x2 = three.x3; quit; The join table could as well have been written: proc sql; create table equijoin as select * from one, two, three where one.x1 = two.x2 and one.x1 = three.x3; quit; It is not evident to me what the author of the e-learning course means by the quotation above. Regard Rune |
|
|
||||
|
||||
|
|
|
|||
|
Rune Runnestø wrote with clarity:
....snip... > It is not evident to me what the author of the e-learning course > means by the quotation above. Me either. You should contact the course administrator and report the section as having mistatements or needing additional narrative. -- Richard A. DeVenezia |
|
|||
|
Rune Runnestø wrote: > I am studying the e-learning course for the SAS Advanced certification, and > in a lesson it says about Creating an Inner Join with Outer Join-Style > Syntax : > ------ > > "General form, SELECT statement for inner join (alternate syntax): > > SELECT column-1<,...column-n> > FROM table-1 | view-1 > INNER JOIN table-2 | view-2 > ON join-condition(s) > <other clauses>; > > An inner join that uses this syntax can be performed on only two tables or > views at a time. When an inner join uses the syntax presented earlier, upto > 32 tables or views can be combined at once. In-line views are covered later > in this lesson." > > ----- > > I wonder what this means - "only two tables at a time". In the code example > below, *three* tables are joined together using the inner join syntax: > > data one; > input x1 $ 1 > a $ 3; > datalines; > 1 a > 2 b > 4 d > ; > data two; > input x2 $ 1 > b $ 3; > datalines; > 2 x > 3 y > 5 v > ; > data three; > input x3 $ 1 > c $ 3; > datalines; > 2 r > 5 s > ; > proc sql; > create table inner_join as > select * > from one > inner join two > on one.x1 = two.x2 > inner join three > on two.x2 = three.x3; > quit; > > The join table could as well have been written: > proc sql; > create table equijoin as > select * > from one, two, three > where one.x1 = two.x2 > and one.x1 = three.x3; > quit; > > It is not evident to me what the author of the e-learning course means by > the quotation above. > > > Regard > Rune Yeah, it works for me in v9. And full joins instead of inner joins work too. But I have a vague recollection of similar >2 table joins not working in some SQL code I tried to write at some point in my life (without parentheses, etc.) ...... Might be a versioning issue, or something not supported in all versions of SQL? Seems to work OK on our DB2, though. |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: proc sql outer join with more than two tables | toby dunn | Newsgroup comp.soft-sys.sas | 0 | 01-10-2009 07:34 PM |
| OUTER JOIN and order of WHERE Clause processing | Hari | Newsgroup comp.soft-sys.sas | 1 | 10-01-2007 12:28 AM |
| Re: Creating an Inner Join with Outer Join-Style Syntax | Sigurd Hermansen | Newsgroup comp.soft-sys.sas | 0 | 12-19-2005 02:57 PM |
| Re: Outer join with a MIN constraint | Sigurd Hermansen | Newsgroup comp.soft-sys.sas | 0 | 09-06-2005 05:50 PM |
| Re: Outer join using SAS datastep | Crawford, Peter1 | Newsgroup comp.soft-sys.sas | 0 | 09-06-2005 02:34 PM |