Skip to content
Advertisement

How to calculate rolling timestamp sum from table partitioned by specific column? – SQL

I have a table with a series of timelines that are normalized starting from 00:00:00.00000. I want to summate them sequentially and stitch them together based on my order_key value.

Sample Data:

Desired Output:

My Attempt:

Advertisement

Answer

Consider below query:

Recursive Approach
Non-recursive Approach

enter image description here

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