I have data in table as :
Timestamp,value1,value2
10/22/2020 0:01,1,0
10/22/2020 0:04,1,0
10/22/2020 0:06,1,0
10/22/2020 0:15,2,1
10/22/2020 0:20,2,1
10/22/2020 0:25,1,2
10/22/2020 0:30,1,2
10/22/2020 0:34,1,2
10/22/2020 0:35,1,2
10/22/2020 0:45,0,1
10/22/2020 0:55,0,1
I want to convert it into following structure :
Start Timestamp,End Timestamp,value1,value2
10/22/2020 0:01,10/22/2020 0:04,1,0
10/22/2020 0:04,10/22/2020 0:06,1,0
10/22/2020 0:06,10/22/2020 0:15,2,1
10/22/2020 0:15,10/22/2020 0:20,2,1
10/22/2020 0:20,10/22/2020 0:25,1,2
10/22/2020 0:25,10/22/2020 0:30,1,2
10/22/2020 0:30,10/22/2020 0:34,1,2
10/22/2020 0:34,10/22/2020 0:35,1,2
10/22/2020 0:35,10/22/2020 0:45,0,1
10/22/2020 0:45,10/22/2020 0:55,0,1
I am using window
function to achieve this but i am not sure how the data should be partitioned
so that I can achieve above.
Help appreciated.