select * from userinfo5,department5
select * from userinfo5,department5 where userinfo5.part_id = department5.id
select * from userinfo5 left join department5 on userinfo5.part_id = department5.id
select * from department5 left join userinfo5 on userinfo5.part_id = department5.id
# userinfo5左边全部显示
# select * from userinfo5 right join department5 on userinfo5.part_id = department5.id
# department5右边全部显示
select * from userinfo5 innder join department5 on userinfo5.part_id = department5.id
将出现null时一行隐藏
#
select * from (
select test1.id,test1.num as n1,test1.name,test2.num as n2 from test1 left join test2 on test1.num = test2.num
UNION
select test1.id,test1.num as n1,test1.name,test2.num as n2 from test2 left join test1 on test1.num = test2.num) as B
全部显示