I have a table in sql which has a number of columns with the same type of data each column. I would like to transpose the table's columns into rows so that all of the data appears in 1 column. An example of the type of table I am talking about:
ID DATE TEST_1 TEST_2 TEST_3
----------------------------------------
1 1jan12 98 66 77
2 2jan12 75 89 72
Into:
ID DATE TEST SCORE
-----------------------------------
1 1jan12 TEST_1 98
1 1jan12 TEST_2 66
1 1jan12 TEST_3 77
2 2jan12 TEST_1 75
2 2jan12 TEST_2 89
2 2jan12 TEST_3 72
Thanks in advance for any suggestions or directions!
PIVOToperator that earlier versions do not. Do you know the set of validTESTvalues at compile time? Or do you want the number of columns in the result to change when a newTEST_4row is inserted in the base table?