Itzik Ben-Gan shows two supported approaches to mimic the GROUPS window frame option, which is part of the SQL standard but currently unsupported in SQL Server.
Itzik Ben-Gan dives deep on two of the more interesting T-SQL enhancements in SQL Server 2022: the new WINDOW clause and the windowing NULL treatment clause.
Queries with multiple ordering needs typically involve sorts in their plans. By following these tips, you can minimize the number of needed sorts. Learn more.