Return a list of related records in SQL Server 2017
I absolutely love SQL (especially SQL Server) and I love how it continually gets better.
A little over four years ago, I wrong an entry on how to return a comma-delimited list of records in SQL Server. It turns out, that it is now much easier to do.
SQL Server 2017 introduced the STRING_AGG function. For those of you doing math, it would have actually been available when I wrote the previous entry, but we'll just ignore that and I'll use the same example.
For example, if you have users that can work in multiple regions and you need a list of which regions they work in.