Select d.Department, jobs.JobIdentifierFrom Departments d cross join (select distinct JobIdentifier from Jobs j) ji LEFT JOIN (Select Distinct j.JobID, j.JobIdentifier, DepartmentID, From Jobs j Join JobsDetail jd on j.JobID = jd.JobID ) jobs on d.DepartmentID = jobs.DepartmentID andji.jobidentifer = jobs.jobIDentifier
我对JobId和JobIdentifier之间的区别还不清楚,所以这可能不太正确。
如果将ji.JobIdentifier添加到
select列表中,即使没有匹配项,您也会看到部门 应该 属于哪个工作。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)