SQL: find continuous date ranges across multiple rows?
问题 I'm trying to get a start and end date combination for continuous spans of time worked. The spans can cross multiple rows, where the end date of the first row is the same as the end date of the next row. The intended result is to show a continuous date range with the sum of hours worked for that range. person startdate enddate hours ------ ----------------------- ----------------------- ------ 5163 2013-04-29 07:00:00.000 2013-04-29 11:00:00.000 4.00 5163 2013-04-29 11:30:00.000 2013-04-29 15