All Forums Enterprise
santosh_74 6 posts Joined 07/09
22 Jul 2009
transpose

Dear all,

How to transpose the data from teradata table?

I have following table structure

id exam1 mar1 exa2 mark2
1 english 50 maths 100
2 english 45 maths 90

i wish to convert into

id exam marks
1 english 50
1 maths 100
2 english 45
2 maths 90

can i use bteq query to do the same?
how to do it using sql?

Regards
santosh

Jimm 165 posts Joined 09/07
23 Jul 2009

Select Id , exam1 As exam, mar1 as marks
from tbl
Union
Select Id, exa2, mark2
Where exa2 is not null
from tbl
;

You must sign in to leave a comment.