Need query help to create time intervals
I need help in a query to get intervals of event and timestamp combination (even if there is a gap of 1 second, we need an additional interval). below are the sample data and expected results.
Input
Activity Activity Time
Sleep 08/15/2022 00:00:01
Sleep 08/15/2022 00:00:02
Sleep 08/15/2022 00:00:03
Sleep 08/15/2022 00:00:04
Sleep 08/15/2022 00:00:05
Sleep 08/15/2022 00:00:06
Resting 08/15/2022 00:00:07
Resting 08/15/2022 00:00:08
Resting 08/15/2022 00:00:09
Walk 08/15/2022 00:00:10
Walk 08/15/2022 00:00:11
Resting 08/15/2022 00:00:15
Resting 08/15/2022 00:00:16
Resting 08/15/2022 00:00:17
Resting 08/15/2022 00:00:30
Resting 08/15/2022 00:00:31
Resting 08/15/2022 00:00:32
Expected Output
Activity Activity Start Time Activity End Time
Sleep 08/15/2022 00:00:01 08/15/2022 00:00:06
Resting 08/15/2022 00:00:07 08/15/2022 00:00:09
Walk 08/15/2022 00:00:10 08/15/2022 00:00:11
Resting 08/15/2022 00:00:15 08/15/2022 00:00:17
Resting 08/15/2022 00:00:30 08/15/2022 00:00:32
Subject
Written By
Posted
Need query help to create time intervals
August 16, 2022 12:31AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.