Link to home
Create AccountLog in
Avatar of Shiju S
Shiju SFlag for United States of America

asked on

Transposing result of a select statement

Hi,

I would like to get transpose of a select statement result.
Is there a way to do this in SQL Server

Col1   Col2   Col3
----   ----   ----
A      B      C
D      E      F
G      H      I   
 
Transpose result
Col1   Col2   Col3
----   ----   ----
A   D   G
B   E   H
C   F   I

Open in new window

Avatar of awking00
awking00
Flag of United States of America image

Can you guarantee an equal number of rows and columns to begin with?
ASKER CERTIFIED SOLUTION
Avatar of David Todd
David Todd
Flag of New Zealand image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Shiju S

ASKER

That helped. thanks a lot