SQL - Consolidate Overlapping Data
问题 I have a simple data set in SQL Server that appears like this **ROW Start End** 0 1 2 1 3 5 2 4 6 3 8 9 Graphically, the data would appear like this What I would like to achieve is to collapse the overlapping data so that my query returns **ROW Start End** 0 1 2 1 3 6 2 8 9 Is this possible in SQL Server without having to write a complex procedure or statement? 回答1: Here's the SQL Fiddle for another alternative. First, all the limits are sorted by order. Then the "duplicate" limits within an