Monday, January 27, 2014

Select query to transform table

I propose a nested cursor solution on ProductID (nested) and CustomerID (outer):


http://ift.tt/Li5S4M


Inside you need dynamic PIVOT for each (CustomerID,ProductID):


http://ift.tt/1dKYASY


You have to setup a @tablevariable or #temptable to collect the results from the nested cursors loop.





Kalman Toth Database & OLAP Architect SELECT Query Video Tutorial 4 Hours

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012



No comments:

Post a Comment