Reputation: 83
I have a result of a query that looks like this:
Is it possible to write a query that will take the relationshipdescriptions
from the above query and group them by person? For example:
I will be using this query in a CTE so I will not be able to use variables.
SQL Server 15.0.2
Upvotes: 0
Views: 27
Reputation: 1269553
You can use string_agg()
:
select personguid, string_agg(relationshipdescription, ',')
from t
group by personguid;
Upvotes: 2