Skip to content
Advertisement

Combining data into one table cell

There is a query that returns a temporary table. TSQL Query:

Result: Random sampling of output values

Is it possible to group data from the last column, thereby reducing the number of lines in the output. That is, I need it to be like this: Desired result

UPD: SQL Server 2016. STRING_AGG is missing

Advertisement

Answer

Group by the values you need (DateYMD,LastName,FirstName) and STRING_AGG can do this


STUFF FOR XML PATH for sqlserver 16 :

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