I have a table in PostgreSQL 9.5 with two timestamps in each row, timestampstart
and timestampstop
.
CREATE TABLE routes(
ID serial PRIMARY KEY,
TIMESTAMPSTART timestamp default NULL,
TIMESTAMPEND timestamp default NULL
);
Now I don´t want to calculate the interval between start and stop, but between stop and the next start. So I want the interval between TIMESTAMPSTOP
from row x and TIMESTAMPSTART
on row x+1. By the way, the ID
is not in chronological order!