請問: 
select * from a,b where a.no=b.no 
與 
select * from a inner join b on a.no=b.no 
有何區別? 
----------------------------------------------
这个我认为没有区别,效率也一样.
------------------------------------------------
另: 
select * from a inner join b on a.no=b.no where a.isposted= 'y' 
與 
select * from a inner join b on a.no=b.no and a.isposted= 'y' 
有何區別?
-------------------------------------------------
这个应该是第一个快.

解决方案 »

  1.   

    --請問: 
    select * from a,b where a.no=b.no 
    --與 
    select * from a inner join b on a.no=b.no 
    --有何區別? 
    查询分析器在执行时,第一句会转为第二种写法,二者一样.
    --另: 
    select * from a inner join b on a.no=b.no where a.isposted= 'y ' 
    --與 
    select * from a inner join b on a.no=b.no and a.isposted= 'y ' 
    --有何區別?ON 是连接条件,WHERE 是过滤条件, 这里不光是效率的问题,而且本质有不同,不同的数据,有可能产生的结果集都不相同.特别针对LEFT JOIN等.