今天用到Left join 竟然将语法写错了......
select * from tt left join tt1 on tt.id=tt1.id
id name id name
--------------------------
1 a 1 a
2 b 2 b
3 c 3 c
select * from tt left join tt1 on tt.id=tt1.id where tt.id=1
id name id name
--------------------------
1 a 1 a
select * 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 NULL
3 c NULL NULL
--left join 以左边表为基础, 扫描右边表匹配的记录
select * from
table1 left join table2 on 条件1
left join table3 on 条件2
left join table4 on 条件3
where 条件4