left join,right join用法简介
方法一(推荐):
select a.man_id,man_name,d.sex_name,zw_name,c.money
from man as a
left join zw as b on a.zw_id=b.zw_id
left join gz as c on a.man_id=c.man_id
left join xb as d on c.sex_id=d.sex_id
方法二:
select Man_Id,Man_Name,sex_name,Zw_Name,Money from
(
select a.Man_Id,Man_Name,b.Zw_Id,Zw_Name,Money,Sex_Id from [Man] a
left join [Zw] b on a.Zw_Id=b.Zw_Id
left join [Gz] c on a.Man_Id=c.Man_Id
)t
left join xb m on m.Sex_Id=t.Sex_Id
方法三:
select man.man_id,man.man_name,xb.sex_name,zw_name,gz.money
from man
left join zw on man.zw_id=zw.zw_id
left join gz on man.man_id=gz.man_id
left join xb on gz.sex_id=xb.sex_id