时间段之间的断点

来源:互联网 发布:合婚尚知时,佳人的诗 编辑:程序博客网 时间:2024/05/24 01:53

select *  from (select tstart,               tend,               lead(tstart) over(order by tstart) next_start,               lead(tend) over(order by tstart) next_end          from t1         where (tstart, tend) not in               (select a.tstart, a.tend                  from t1 a, t1 b                 where (a.tstart >= b.tstart and a.tend < b.tend)                    or (a.tstart > b.tstart and a.tend <= b.tend)                    or (a.tstart > b.tstart and a.tend < b.tend))) where next_start > tend;
断点:23-24
TSTARTTENDNEXT_STARTNEXT_END19232430

0 0
原创粉丝点击