select `a`.`tdorderid`,group_concat('类型:',(case `a`.`td_type` when 'no_goods' then '无货退款' when 'low_quantity' then '质量退款'
when 'no_reason' then '非质量退款' else '无' end),'/退货员:',(case when`a`.`td_user` is null then '无'
when `a`.`td_user` is not null then `a`.`td_user` end) separator ',') AS `goods1` from `gr_reject_goods` `a` group by `a`.`tdorderid`
在group_concat函数里面使用case when 语法与一般情况无异。
case when 在判断是否为null的时候要注意,字段 is null ,字段is not null
————————————————
版权声明:本文为CSDN博主「code旅行者」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/dotNET25/article/details/52610436