Expert T-SQL Window Functions in SQL Server 2019 - 9781484251966
Once you begin using window functions, such as ROW_NUMBER and LAG, you will discover many ways to use them. You will approach SQL Server queries in a different way, thinking about sets of data instead of individual rows.