Skip to content
Advertisement

Convert values in related table to comma-separated list

I have two SQL Server tables:

I’m trying to the following result where the related activities are in a comma-separated list:

I tried:

Can someone help me with this SQL query? Thank you.

Advertisement

Answer

You could use OUTER APPLY to aggregate the string if you’re using SQL Server 2017 or higher.

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