Re: [SQL] value from max row in group by

2013-07-26 Thread Gary Stainburn
Sorry, but I never thought. I'm developing this on my server I'm developing it for someone else who wants it in a WordPress / MySQL environment (I don't know MySQL). Would this or something similar work in mysql? (Sorry for going O.T.) On Thursday 25 July 2013 19:53:06 Marc Mamin wrote: > >___

Re: [SQL] value from max row in group by

2013-07-25 Thread Marc Mamin
57 AM To: pgsql-sql@postgresql.org Subject: Re: [SQL] value from max row in group by 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,

Re: [SQL] value from max row in group by

2013-07-25 Thread Venky Kandaswamy
: pgsql-sql@postgresql.org Subject: Re: [SQL] value from max row in group by 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, stt

Re: [SQL] value from max row in group by

2013-07-25 Thread bricklen
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 durati

Re: [SQL] value from max row in group by

2013-07-25 Thread Gary Stainburn
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 timeta

[SQL] value from max row in group by

2013-07-25 Thread Gary Stainburn
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 would