ID为1有的不能在ID为2,3,4,5,6,7,8,9等等的类型中出现,同类型ID为2也不能出现后面 2,3,4,5,6等等类型的值 with t1 as(select distinct a.eid,a.name,a.age,c.ID, case when c.Title = '高管级' then '公司领导' when c.Title = '部门正职' then '部门正职' when c.Title = '总助级' then '总助级' when c.Title = '部门副职' then '部门副职' when c.Title = '副总工程师' then '副总工程师' when c.Title = '主任工程师' then '主任工程师' when c.Title = '部门副职' then '部门副职' when c.Title = '部门助理' then '部门助理' when b.Title = '项目管理职务' then '项目经理' when c.Title = '副主任工程师' then '副主任工程师' else '其他' end as TYPE, f.Title as 单元 from ods_GBMX a left join ODS_ECD_ZWTYPE b on a.zwtypy = b.ID LEFT JOIN ods_ECD_ZWLEVEL c on a.zwlevel = c.ID left JOIN ODS_ECD_EMPCUSTOM2 d on d.ID = a.jobid left join ODS_EVW_EMPOLYEE e on e.EID = a.eid left join ODS_OUNIT f on f.UTID = e.utid WHERE RCPID = 3) select * from t1 where type not in ('其他','项目经理') order by id |
最佳回答 |
||||
0
|
|