日期:2014-05-16 浏览次数:20900 次
select ID_NO_SZ ,NAME_SZ, max(case BAN when 'D01+E01' then DAYS else 0 end) "D01+E01", max(case BAN when 'D02+E02' then DAYS else 0 end) "D02+E02", max(DIR) DIR from tb group by ID_NO_SZ ,NAME_SZ select ID_NO_SZ ,NAME_SZ, max(decode (BAN ,'D01+E01' , DAYS , 0 )) "D01+E01", max(decode (BAN ,'D02+E02' , DAYS , 0 )) "D02+E02", max(DIR) DIR from tb group by ID_NO_SZ ,NAME_SZ
------解决方案--------------------
select ID_NO_SZ ,NAME_SZ, max(case BAN when 'D01+E01' then DAYS else 0 end) "D01+E01", max(case BAN when 'D02+E02' then DAYS else 0 end) "D02+E02", max(DIR) DIR from tb group by ID_NO_SZ ,NAME_SZ
------解决方案--------------------
select ID_NO_SZ ,NAME_SZ, max(decode (BAN ,'D01+E01' , DAYS , 0 )) "TA夜班出勤天数1", max(decode (BAN ,'D02+E02' , DAYS , 0 )) "TA夜班出勤天数2", max(DIR) DIR from tb group by ID_NO_SZ ,NAME_SZ