Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT e.start_time, ne.start_time, e.end_time
- FROM
- (SELECT e.ID, e.start_time, e.end_time, ROW_NUMBER() OVER (PARTITION BY e.ID ORDER BY e.start_time) AS "SEQ"
- FROM events e
- )e
- LEFT JOIN
- (SELECT ne.ID, ne.start_time, ne.end_time, ROW_NUMBER() OVER (PARTITION BY ne.ID ORDER BY ne.start_time) AS "nSEQ"
- FROM events ne
- )ne
- ON e.ID = ne.ID
- AND e.SEQ = ne.nSEQ - 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement