JFrizz JFrizz - 1 year ago 67
SQL Question

Append column to view

enter image description here

I'm get this data from my view. I need to take the information and shift the different Amount Types into columns of their own. This can be done by creating a view for each type and combining them later into a single view. But is there a a way to do this all in a single view?

I was thinking about using subquery or union, but I am relatively new to this and not sure if it's the best course of action.

Answer Source

Try a pivot:

    SELECT * 
) piv
(MAX(Amount) FOR Type IN ([401k], [Roth], [Employer Match]) thisshoudwork
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download