selectt.taskId,t.reportNo,CAST(t.AAASchar)S1_date,CAST(t.AA1ASchar)F1_date,CAST(t.BBASchar)S2_date,CAST(t.CCASchar)S3_date,CAST(t.CC1ASchar)F2_date,CAST(t.DDASchar)S4_dat...
select t.taskId, t.reportNo, CAST(t.AA AS char) S1_date, CAST(t.AA1 AS char) F1_date, CAST(t.BB AS char) S2_date, CAST(t.CC AS char) S3_date, CAST(t.CC1 AS char) F2_date, CAST(t.DD AS char) S4_date, CAST(t.DD1 AS char) F3_date FROM (
select taskid, reportNo, group_concat(case statuslog WHEN 'S1' then operateDate else null end) AA,
group_concat(case statuslog WHEN 'F1' then operateDate else null end) AA1,
group_concat(case statuslog WHEN 'S2' then operateDate else null end) BB,
group_concat(case statuslog WHEN 'S3' then operateDate else null end) CC,
group_concat(case statuslog WHEN 'F2' then operateDate else null end) CC1,
group_concat(case statuslog WHEN 'S4' then operateDate else null end) DD,
group_concat(case statuslog WHEN 'F3' then operateDate else null end) DD1
from v_taskreport GROUP BY taskId ORDER BY taskId
) as t
展开