六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 54|回复: 0

竟然不会Left join了

[复制链接]

升级  23.33%

23

主题

23

主题

23

主题

秀才

Rank: 2

积分
85
 楼主| 发表于 2013-1-27 05:15:06 | 显示全部楼层 |阅读模式
今天用到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 tt  left join tt1  on tt.id=tt1.id where tt.id=1id   name   id   name--------------------------1    a          1       aselect * from tt  left join tt1 on tt.id=tt1.id and tt.id=1 id   name   id   name--------------------------1      a       1      a    2      b    NULL  NULL3      c    NULL  NULL--left join 以左边表为基础, 扫描右边表匹配的记录select   *   fromtable1   left   join   table2   on   条件1   left   join   table3   on   条件2   left   join   table4   on   条件3  where   条件4
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表