CHAPTER 3
Ordered Set Functions
Have you ever needed to concatenate elements of a group into one string based on some order? That’s a scenario that an ordered set function could help address. An ordered set function is a type of aggregate function. What distinguishes it from a general set function (like SUM, MIN, MAX, and so on) is that there’s ordering relevance to the calculation, such as the order in which you want to concatenate the elements.
In this chapter, I will discuss ordered set functions and the kinds of solutions they help with. At the date of this writing, the only ordered set function that SQL Server supports is STRING_AGG for string concatenation. This function was added in SQL Server 2017. There are additional ordered set functions ...
Get T-SQL Window Functions: For data analysis and beyond, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.