I don't think so. I did the following similar pivot against
AdventureWorksDW and it worked OK.
GO
SELECT AccountKey, DepartmentGroupKey,[1] as Scen1, [2] as Scen2
FROM FactFinance
PIVOT (Sum(Amount) for ScenarioKey IN([1],[2])) as x
ORDER BY AccountKey, DepartmentGroupKey;
--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell
In article <1134326351.348930.297780 (AT) g44g2000cwa (DOT) googlegroups.com>,
rmgalante (AT) yahoo (DOT) com says...
Quote:
I am trying to implement a simple pivot table with the following sql
statement, but the query analyzer reports a syntax error.
SELECT CategoryName AS Category, ProductName AS Product, [1] AS
Y1997Q1, [2] AS Y1997Q2, [3] AS Y1997Q3, [4] AS Y1997Q4
FROM dbo.OrdersByProduct1997
PIVOT (SUM(ProductOrders) FOR Quarter IN([1], [2], [3], [4])) AS
QuarterlyOrders
ORDER BY CategoryName, ProductName
Incorrect syntax near '('
Is the command parser broken? |