首页 > 数据库技术 > 详细

mysql的group_concat列转行函数

时间:2019-04-02 22:31:43      阅读:150      评论:0      收藏:0      [点我收藏+]
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列转行函数

原文:https://www.cnblogs.com/hejunhong/p/10645828.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!