Reputation: 585
I have an Table containing data's as follows,
I want them to be seperated as Start Time and End time where the Start and end are same for first row while second row start time is first row End time.
Upvotes: 1
Views: 95
Reputation: 1269445
You want lag()
:
select t.*,
lag(time, 1, time) over (order by time) as starttime,
time as endtime
from t;
Upvotes: 5