mysql的group_concat列转行函数

时间:2023-03-09 19:43:34
mysql的group_concat列转行函数
SELECT
auditor,sum(count) total,
GROUP_CONCAT(type,'=', count) AS type_count
FROM
auditor_dm_ol
WHERE created = 20190402
GROUP BY
auditor
UNION
SELECT a.auditor ,SUM(a.total),GROUP_CONCAT(a.type,'=',a.total) from (
SELECT 'all' auditor ,type,sum(count) total FROM
auditor_dm_ol
WHERE created = 20190402
GROUP BY type
)a ORDER BY total desc 展示要求

mysql的group_concat列转行函数

数据结果

mysql的group_concat列转行函数