Creating comma separated strings from a column, or delimited strings as I like to call it, is a very common problem in SQL. Beginning with SQL Server 2017 and Azure SQL Database, there is now another option to the existing set of solutions, STRING_AGG().
I would like to convince you to use STRING_AGG over the other methods. So, let us begin with the competing solutions.
I completely agree and have been switching code over to use STRING_AGG since upgrading to 2017. The code is so much clearer as a result compared to STUFF + FOR XML PATH concatenation.