Go Back   Rhinocerus > Newsgroup > Newsgroup comp.soft-sys.sas

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-19-2005, 08:17 AM
Rune Runnestø
Guest
 
Posts: n/a
Default Creating an Inner Join with Outer Join-Style Syntax

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


Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 12-19-2005, 02:51 PM
Richard A. DeVenezia
Guest
 
Posts: n/a
Default Re: Creating an Inner Join with Outer Join-Style Syntax

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


Reply With Quote
  #3 (permalink)  
Old 12-19-2005, 05:27 PM
z
Guest
 
Posts: n/a
Default Re: Creating an Inner Join with Outer Join-Style Syntax


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.

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


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



All times are GMT. The time now is 08:35 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.