I have a table with ~three columns, one is for id, and the rest of them contains a timestamp value:
id | start_date | end_date
I want to make a query that will return me the difference between two events next to each other. So far I wrote sql query:
SELECT start_date, end_date FROM table ORDER BY begin_date asc
and now I don't know how is it possible to get the difference between different rows, for example:
I have three rows:
1 | 1428443952 | 1428444010
2 | 1428443952 | 1428443973
3 | 1428443952 | 1428443975
and I want to make a query that will return me the difference between
(start_date of id2) - (end_date of id1)
(start_date of id3) - (end_date of id2)
etc.
Is that even possible?