Skip to content
Advertisement

How to transform one SQL column into multiple columns on the same row?

I am working in a Progress ODBC in Excel and I have a data set that currently holds an ID, Object type and the result for that object. The dataset looks a little like below:

I am trying to get this data to all sit on one line by using the following CASE WHEN

What i am finding is that this results in a stepped result. So my returned data still comes back on multiple lines. Much like this:

Is there something i can do to return this result on the one line?

Advertisement

Answer

You need a GROUP BY:

Note: Single quotes are used in SQL to define strings and date constants. Do not use them for column aliases. One day, that is just going to cause you problems, when you refer to a column using single quotes but it is interpreted as a string.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement