SQL Server Performance Forum – Threads Archive
Using Pivot with a matrix-like tableHello I have a table which is declared as Matrix(#Row as int, #Column as int, Value as numeric); this table stores data of a real matrix which has 20 rows and 5 columns. I would like to make a SELECT statement that uses the PIVOT operator in order to make a resultset of the matrix. Something like: Row Col1 Col2 Col3 Col4 Col5
1 23 45 46 78 89
2 12 56 34 79 23
… The data is stored as (select * from Matrix):
1, 1, 23
1, 2, 45
1, 3, 46
… Thanks a lot.
SQL Server 2005 Books Online
Using PIVOT and UNPIVOT http://msdn2.microsoft.com/en-us/library/ms177410.aspx
SQL-Server-Performance.com All postings are provided â€œAS ISâ€ with no warranties for accuracy.