使用Pivot对T-SQL进行ACCESS查询

时间:2011-04-21 17:48:48

标签: sql-server tsql

问候,我很难将此查询转换为T-SQL,我将不胜感激

TRANSFORM Sum(ViewMaster.ServiceCount) AS SumOfServiceCount
SELECT ViewMaster.Response, Sum(ViewMaster.ServiceCount) AS [Total Of ServiceCount]
FROM ViewMaster
GROUP BY ViewMaster.Response
PIVOT ViewMaster.Month;

1 个答案:

答案 0 :(得分:0)

以下内容:

SELECT *
FROM ( SELECT Response, ServiceCount, Month
       FROM ViewMaster) VM
PIVOT(SUM(ServiceCount) FOR Month IN ('January','February',...,'December'))