Friday, April 25, 2014

PIVOT Row into column Month


SELECT * FROM(SELECT FYear,[State],StateCode,LOBName,LOBCode,ProductName,ProductCode,RegionName,RegionCode,[FMonth],Membership
  FROM #temp )t PIVOT (SUM(Membership)
  FOR [FMonth] IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12] )) AS pvt 

No comments: