简单举例一下:
A表
id name
1 a
2 b
3 c
4 d
___________________________________________
B表
id name
3 e
4 f
5 g
左联:select A.*,B.* from A left join B on A.id=B.id
显示结果:
id name id name
1 a null null
2 b null null
3 c 3 e
4 d 4 f
右联:select A.*,B.* from A right join B on A.id=B.id
显示结果:
id name id name
3 e 3 e
4 f 4 f
null null 5 g
全联:select A.*,B.* from A full join B on A.id=B.id
id name id name
1 a null null
2 b null null
3 c 3 e
4 d 4 f
5 null 5 g
_________________________________________________________________________________
阅读(430) | 评论(0) | 转发(0) |