我需要一些帮助尝试在MYSQL中获取以下输出。 鉴于我不有权创建临时表 如何使用 MySQL 语法
输出以下行这是sql
中数据的抽样 Create table #Temp
( Category varchar(20)
,CreatedMonth int
,NumberOfIssues int
)
Insert into #Temp
SELECT 'Access Support',9,28
UNION ALL
SELECT 'Ecom Support',9,76
UNION ALL
SELECT 'Inhouse ',9,7
UNION ALL
SELECT 'Access Support',10,59
UNION ALL
SELECT 'Server Support',10,23
我想要的MySQL中的Resulset是 类别Month_9 Month_10
The first row having the values of [Access Support],28,59
The second row having the values of [Ecom Support],76,0
The third row having the values of [Inhouse ],7,0
The fourth row having the values of [Server Support],0,23
至少定义了30个类别。
感谢您的任何建议。 SD
答案 0 :(得分:0)
SELECT Category, GROUP_CONCAT(NumberOfIssues) FROM yourtable WHERE CreatedMonth BETWEEN 9 AND 10 GROUP BY Category