SQL: Merge Date Ranges
问题 I've a table, which describes work slices of a business working calendar: (date format is 24 hours format) PK | STARTDATE | ENDDATE __________________________________________ 1 | 2012/07/21 02:00 | 2012/07/21 04:00 2 | 2012/07/21 03:00 | 2012/07/21 10:00 3 | 2012/07/21 06:00 | 2012/07/21 17:00 4 | 2012/07/21 18:00 | 2012/07/21 19:00 Now, I like to merge the date ranges (within a given start and end date) like this: PK | STARTDATE | ENDDATE __________________________________________ 1 | 2012