select t.* from nametable t inner join addresstable s on t.aid=s.id and t.id='3'select t.* from nametable t left join addresstable s on t.aid=s.id where t.id='3'select t.* from nametable t,addresstable s where t.aid=s.id and t.id='3'我对JOIN的东西不是很熟,就会用WHERE.帮忙看下,最好能推荐一些把WHERE 转为JOIN的例子

解决方案 »

  1.   

    补充一下:
    t.id s.id为主键
    在t.id t.aid s.id上都有索引
      

  2.   

    第一条和第三条语句是一样的,只是写法不同。效率也一样。至于第二条,他是left outer join效率相对inner会差一些。
      

  3.   

    select t.* from nametable t inner join addresstable s on t.aid=s.id and t.id='3' 
    select t.* from nametable t inner join addresstable s on t.aid=s.id where t.id='3' 这两个有什么不同啊.