日期:2014-05-18 浏览次数:20501 次
select * from dbo.tbl_staffMove ←全查语句 联查语句↓ select sm.id,st.uname,dp.name as oldname,dp1.name as newdname, sm.kind,sm.remark,sm.createTime,ad.loginName from tbl_staffMove as sm inner join tbl_staff as st on st.id = sm.staffId left join tbl_admin as ad on ad.id = sm.adminId left join tbl_departMent as dp on dp.id = sm.OldDepart --从调动表中获取原部门 left join tbl_departMent as dp1 on dp1.id = st.departId --从人员表中获取新部门
select sm.id,st.uname,dp.name as oldname,dp1.name as newdname, sm.kind,sm.remark,sm.createTime,ad.loginName from tbl_staffMove as sm inner join tbl_staff as st on st.id = sm.staffId left join tbl_admin as ad on ad.id = sm.adminId left join tbl_departMent as dp on dp.id = sm.OldDepart --从调动表中获取原部门 left join tbl_departMent as dp1 on dp1.id = sm.newDepart --从人员表中获取新部门