Hi folks,
I need help please.
I have a table of trip section details which includes a trip ID, start time as
an offset, and a duration for that section.
I need to extract the full trip duration by adding the highest offset to it's
duration. I can't simply use sum() on the duation as that
As usual, once I've asked the question, I find the answer myself.
However, it *feels* like there should be a more efficient way. Can anyone
comment or suggest a better method?
timetable= select stts_id, stts_offset+stts_duration as total_duration
timetable- from standard_trip_sections
On Thu, Jul 25, 2013 at 10:45 AM, Gary Stainburn
gary.stainb...@ringways.co.uk wrote:
Hi folks,
I need help please.
I have a table of trip section details which includes a trip ID, start
time as
an offset, and a duration for that section.
I need to extract the full trip duration by
You can use Postgres WINDOW functions for this in several different ways. For
example, one way of doing it:
select stts_id, last_value(stts_offset) over (partition by stts_id order by
stts_offset desc)
+ last_value(stts_duration) over (partition by stts_id order
by
Von: pgsql-sql-ow...@postgresql.org [pgsql-sql-ow...@postgresql.org]quot; im
Auftrag von quot;Venky Kandaswamy [ve...@adchemy.com]
You can use Postgres WINDOW functions for this in several different ways. For
example, one way of doing it:
select