I have a need to retrieve data from a table that currently stores data as iterative rows (e.g., column1, column2, etc.) I need to retrieve that as a generic set of columns with the repeated column data as rows.
SELECT
CASE Num
WHEN 1 THEN Col1
WHEN 2 THEN Col2
WHEN 3 THEN Col3
...
END
FROM
YourTable T
CROSS JOIN (SELECT Num = 1 UNION SELECT 2 UNION SELECT 3 ...) X
[COLOR=#aa88aa black]Cum catapultae proscriptae erunt tum soli proscript catapultas habebunt.[/color]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.