Skip to Main Content
T-SQL Window Functions: For data analysis and beyond, 2nd Edition
book

T-SQL Window Functions: For data analysis and beyond, 2nd Edition

by Itzik Ben-Gan
November 2019
Intermediate to advanced content levelIntermediate to advanced
352 pages
12h 27m
English
Microsoft Press
Content preview from T-SQL Window Functions: For data analysis and beyond, 2nd Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL for Data Analysis

SQL for Data Analysis

Cathy Tanimura

Publisher Resources

ISBN: 9780135861554