Tags / gaps-and-islands
Creating Date Ranges from Multiple Rows Based on a Single Date
Merging Overlapping Date Ranges in SQL Server 2014
SQL Query to Calculate Sum of Values for Each User and Date, Treating Consecutive Days as a Single Day
Handling Missing Primary Keys for Derived Columns: The LAG/LEAD Puzzle in SQL Server 2012
Selecting Records Where Only One Parameter Changes Using SQL and LINQ: A Deep Dive