Hi,I am playing with PIVOT for the first time on a very simple table on SQL Server 2005 (Standard) but am failing miserably!!The table is a list of sites and price deviations eg:Product_ID Site_ID PriceABC1 1 10.40ABC1 2 11.20XYZ1 1 20.30XYZ1 2 19.49XYZ1 3 21.02
And all I want to do is produce a summary of stock items and the price deviation per site - eg:Product Site1 Site2 Site3...ABC1 10.40 11.20 XYZ1 20.30 19.49 21.02
The query I have written excludes 'hidden' items and looks like this:select *from (SELECT CodeId ,IsHidden ,SiteId ,PricePerPack FROM database.pricetable where isHidden = 0 ) as D PIVOT ( PricePerPack ) as P
But I just get:Msg 102, Level 15, State 1, Line 14Incorrect syntax near ')'.
I presume I am missing the point on something obvious but it escapes me at the moment so a shove in the right direction would be appreciated.Thanks