Avatar of Culwatrnca11
Culwatrnca11
Flag 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?

,case
      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"
SQL* TeradataMicrosoft SQL Server

Avatar of undefined
Last Comment
Culwatrnca11

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
PortletPaul

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Culwatrnca11

ASKER
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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck