avaj 发表于 2013-2-4 23:44:38

竟然不会Left join了

今天用到Left join 竟然将语法写错了......
 
select * from tt left join tt1 on tt.id=tt1.id id   name   id   name--------------------------1    a          1       a2    b          2       b3    c          3      cselect * from ttleft join tt1on tt.id=tt1.id where tt.id=1id   name   id   name--------------------------1    a          1       aselect * from ttleft join tt1 on tt.id=tt1.id and tt.id=1 id   name   id   name--------------------------1      a       1      a    2      b    NULLNULL3      c    NULLNULL--left join 以左边表为基础, 扫描右边表匹配的记录select   *   fromtable1   left   join   table2   on   条件1   left   join   table3   on   条件2   left   join   table4   on   条件3where   条件4
页: [1]
查看完整版本: 竟然不会Left join了