Skip to content
Advertisement

SQL convert rows to one Column

I have a table,

Output before pivoting:

Expected output:

How to do that for three or more rows but always with to one-row column?

Advertisement

Answer

You can use conditional aggregation:

However, I might suggest that you if you want all values in a single row that you just use arrays:

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