SQL 语句
SELECT MIN(StartTime),MAX(StopTime) FROM (
(SELECT StartTime,StopTime,SUM(broken) OVER (ORDER BY StartTime,StopTime) flag
FROM (SELECT T.*,
(CASE WHEN StartTime <= MAX(StopTime) OVER (ORDER BY StartTime,StopTime ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) THEN 0 ELSE 1 END) AS broken
FROM tableName T) T1) )T2
GROUP BY flag