Back in July 2010, I was asked the following question by Pramod:
Is it possible to get a Pivot Table kind of an output as a result of a query. For example I have a table like this
Id Date Sales Region
and as an output I want the a list of region wise sales with a monthly breakup and the respective sales.
Can you help?
My suggestion was to use the query below:
SELECT Region,  AS Jan2010,  AS Feb2010,  AS Mar2010,  AS Apr2010,  AS May2010,  AS June2010,  AS July2010 FROM ( SELECT Region, Sales, MONTH([Date]) AS SalesMonth FROM Sales) S PIVOT ( SUM (Sales) FOR SalesMonth IN ( , , , , , ,  ) ) AS pvt ORDER BY pvt.Region
This assumed at the time that all the data was for 2010.