- SELECT DATE,GROUP_CONCAT(NAME) FROM tabname GROUP BY DATE
4、行转列统计数据
- SELECT DATE, GROUP_CONCAT(NAME,‘总量:‘,Scount) AS b_str FROM tabName GROUP BY DATE
- SELECT DATE,NAME, GROUP_CONCAT(NAME,‘总量:‘,Scount) AS b_str FROM TabName GROUP BY DATE ,NAME
标签:cat margin tps https ext div tool func sele
SELECT a.`name`,a.mon,
SUM(CASE RIGHT(a.mon,2) WHEN ‘01‘ THEN sa ELSE 0 END) ‘01月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘02‘ THEN sa ELSE 0 END) ‘02月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘03‘ THEN sa ELSE 0 END) ‘03月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘04‘ THEN sa ELSE 0 END) ‘04月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘05‘ THEN sa ELSE 0 END) ‘05月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘06‘ THEN sa ELSE 0 END) ‘06月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘07‘ THEN sa ELSE 0 END) ‘07月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘08‘ THEN sa ELSE 0 END) ‘08月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘09‘ THEN sa ELSE 0 END) ‘09月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘10‘ THEN sa ELSE 0 END) ‘10月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘11‘ THEN sa ELSE 0 END) ‘11月‘,
SUM(CASE RIGHT(a.mon,2) WHEN ‘12‘ THEN sa ELSE 0 END) ‘12月‘
FROM sale a
GROUP BY a.mon
行转列列传行更具体例子
1、查看数据
2、列转行统计数据
4、行转列统计数据
标签:cat margin tps https ext div tool func sele
原文地址:https://www.cnblogs.com/jentary/p/11579319.html