Tags / gaps-and-islands
Creating Time Windows with Alternating Values in T-SQL
SQL Window Functions for Aggregate Calculations with the COALESCE and MAX Approach
Calculating Average Duration in Status: Gaps and Islands in Equipment Repair Data
SQL Query to Calculate Sum of Values for Each User and Date, Treating Consecutive Days as a Single Day