Optimal way to concatenate/aggregate strings
STRING_AGG() in SQL Server 2017, Azure SQL, and PostgreSQL: https://www.postgresql.org/docs/current/static/functions-aggregate.html https://docs.microsoft.com/en-us/sql/t-sql/functions/string-agg-transact-sql GROUP_CONCAT() in MySQL http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function_group-concat (Thanks to @Brianjorden and @milanio for Azure update) Example Code: select Id , STRING_AGG(Name, ‘, ‘) Names from Demo group by Id SQL Fiddle: http://sqlfiddle.com/#!18/89251/1