SAS中文论坛

标题: SQL中INNER JOIN的问题 [打印本页]

作者: shiyiming    时间: 2004-5-13 04:40
标题: SQL中INNER JOIN的问题
下面是从SAS网站上看到的程序,希望知道这两个程序是否有区别,结果似乎一样,是否有其他方面的区别。
proc sql;
title 'Inner Join';
select *
from lefttab as l, righttab as r
where l.continent=r.continent;
-------------------------------------------------
proc sql;
title 'Inner Join';
select *
from lefttab as l inner join
righttab as r
on l.continent=r.continent;
作者: shiyiming    时间: 2004-5-13 07:59
I think there is no difference if the syntax for the second one is correct.  The first one is the syntax mostly used for inner join, I have never tried to write something as the second one.  Surely, the left join, right join and full join follows the syntax as the second one.
作者: shiyiming    时间: 2004-5-13 10:32
标题: re:
我个人觉得这两个程序并没有太大的区别:
它们执行后的结果是相同的.要说区别那可能就是它们在执行过程不同:
proc sql;
title 'Inner Join';
select *
from lefttab as l, righttab as r   
where l.continent=r.continent;
//这段程序是从两张表中取记录,然后比较字段continent,得到结果.
proc sql;
title 'Inner Join';
select *
from lefttab as l inner join
righttab as r
on l.continent=r.continent;
//这段程序就是先将两张表进行连接,然后在连接后的结果中进行删选.得到结果.
-----------------------------------------
个人想法!




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2