transpose

UDA
Enthusiast

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
1 REPLY
Enthusiast

Re: transpose

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