Skip to content
Advertisement

Combine SQL rows into one column based off two other columns

I have this SQL statement:

It returns a table like:

But I am looking to have something like this:

How do I change my SQL statement to accomplish this?

Advertisement

Answer

The solution to this problem ended up being to create a temp table for the main query. Then pulling the appropriate data out of the temp table utilizing the FOR XML PATH () function.

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