I propose a nested cursor solution on ProductID (nested) and CustomerID (outer):
Inside you need dynamic PIVOT for each (CustomerID,ProductID):
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