日期:2014-05-18 浏览次数:20502 次
select * from table1 a left join table2 b on a.userid=b.userid left join table3 c on a.userid=c.userid left join table4 d on c.depid=d.depid left join table5 e on a.userid=e.userid
------解决方案--------------------
select *from( select *from( select * from table1 union all select * from table2 )a left join table2 on a.userid=table2.userid) b left join (select table4 .deptid,table3 * from table4 left join table3 on table4 .deptid=table3.userid)c on b.userid=c.userid
------解决方案--------------------
Select *
From Table1 Left Join Table2 On (Table1.userid = Table2.userid)
Left Join Table3 On (Table2.jobid = Table3.jobid And Table1.userid = Table3.userid)
Left Join Table4 On (Table3.jobid = Table4.jobid And Table3.userid = Table4.userid And Table3.depid = Table4.depid)
Left Join Table5 On (Table1.userid = Table5.userid)