Eliminate and reduce overlapping date ranges
For SQL Server 2005+ — sample table with data declare @t table(UserID int, StartDate datetime, EndDate datetime) insert @t select 1, ‘20110101’, ‘20110102’ union all select 1, ‘20110101’, ‘20110110’ union all select 1, ‘20110108’, ‘20110215’ union all select 1, ‘20110220’, ‘20110310’ union all select 2, ‘20110101’, ‘20110120’ union all select 2, ‘20110115’, ‘20110125’ — your … Read more