[SQL] Query to match location transitions
I was hoping someone could help me build a better query. I have a table of
time/locations. Occasionally, we have multiple timestamps for the same
location. I would like to remove those extra timestamps and only show the
transition from one location to another. So...
create table time_locations (
timestamp double precision,
I would like to return a table like:
The only way I can think of to do this would be a procedure which would do a
large loop over the
table (sorted by time) returning a row when last.location <> this.location.
However, when I try this on a
large table, it seems like the 'select into' doesn't order & ruins the whole
Is there a query approach?
View this message in context: http://www.nabble.com/Query-to-match...p20506709.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
Sent via pgsql-sql mailing list (email@example.com)
To make changes to your subscription: