Skip to content
Advertisement

How do I find the time periods (start and end time) by calculating the difference between two columns?

I have a table that:

So, the time period for which the server was offline, the resultant desired table:

I tried the following query:

I am unable to logically write out the query, the above one certainly does not work.

Advertisement

Answer

You can use lead():

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement