So I have a table with 3 columns A (ID), B (Timestamp) and C(Binary). I would like to know the duration an ID takes between 0 and 1 (I Don't consider from 1 to 0)
A B C
x t1 0 #(t1=1528362158)
y t2 1 #(t2=1534675468)
x t3 1 #(t3=1534675492)
x t4 0 #(t4=1534675748)
y t5 0 #(t5=1534675939)
y t6 1 #(t6=1534676003)
x t7 1 #(t7=1534676067)
I would like to have the Following table:
ID Duration
x (t3-t1)+(t7-t4)
y t6-t5