Hi
I am trying to create a pivot table in MS Query using SQL for an Excel worksheet I have.
What I've been doing to assist with SQL code is write in an MS-Access query and then copy the SQL code from there to MS Query.
However, I can't get it to work for a pivot table. The MS Access formula indicates:
TRANSFORM Sum([09_10].[Unique Individual]) AS [SumOfUnique Individual] SELECT [09_10].[Reason for Discharge], Sum([09_10].[Unique Individual]) AS [Total Of Unique Individual] FROM 09_10 WHERE ((Not ([09_10].[Reason for Discharge]) Is Null)) GROUP BY [09_10].[Reason for Discharge] PIVOT Format([Discharge Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
However, I keep getting errors on the TRANSFORM statement and it doesn't like the format "mmm" statement.
Any and all assistance greatly appreciated!
Thanks.
Shelby
I am trying to create a pivot table in MS Query using SQL for an Excel worksheet I have.
What I've been doing to assist with SQL code is write in an MS-Access query and then copy the SQL code from there to MS Query.
However, I can't get it to work for a pivot table. The MS Access formula indicates:
TRANSFORM Sum([09_10].[Unique Individual]) AS [SumOfUnique Individual] SELECT [09_10].[Reason for Discharge], Sum([09_10].[Unique Individual]) AS [Total Of Unique Individual] FROM 09_10 WHERE ((Not ([09_10].[Reason for Discharge]) Is Null)) GROUP BY [09_10].[Reason for Discharge] PIVOT Format([Discharge Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
However, I keep getting errors on the TRANSFORM statement and it doesn't like the format "mmm" statement.
Any and all assistance greatly appreciated!
Thanks.
Shelby