select t3.departmentname, wm_concat(t3.a), wm_concat(t3.b), wm_concat(t3.c)
from (select t1.departmentname,decode(t.ondutydate,'20120526080000',t.leadername) as a,
decode(t.ondutydate,'20120527080000',t.leadername) as b,
decode(t.ondutydate,'20120528080000',t.leadername) as c
from ONDUTY_LEADERDUTY t,DEPARTMENT t1 where t1.departmentid=t.departmentid(+)
and t.ondutydate>='20120526080000' and t.ondutydate<='20120528080000' and t1.fatherdepartmentid='1121040000000'
)t3 group by t3.departmentname
列转行+合并一行
猜你喜欢
转载自love398146779.iteye.com/blog/1542161
今日推荐
周排行