mysql case when合并_mysql case when问题:如何把下面的AA和AA1合并,CC和CC1,DD和DD1合并,也就是说statuslog S1和F1是一类...

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

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值