Link to home
Create AccountLog in
Avatar of Culwatrnca11
Culwatrnca11Flag for United States of America

asked on

Teradata SQL - Is it possible to take each line item and turn into column headers.

I have this code which displays each DX number in one column.  I would like these to show in 5 different columns as the headers, is that possible?

      when dx.line = 1 then 'DX_1'      
      when dx.line = 2 then 'DX_2'      
            when dx.line = 3 then 'DX_3'      
            when dx.line = 4 then 'DX_4'      
            when dx.line = 5 then 'DX_5'      
            else 'N/A'      
end as "DX_Line"
Avatar of PortletPaul
Flag of Australia image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Culwatrnca11


Thanks PortletPaul, this was very helpful.  I was able to obtain a report utilizing this format and the usage of max(case when...  to create a sub subquery in my existing report.