MySQL query

Associate
Joined
26 Oct 2003
Posts
1,107
Hi,

I have a MySQL table containing GPS waypoints of a running session, with each waypoint containing a routeID, longitude, latitude, altitude and time. The time is stored in seconds since the start of the run.

I need to create a query to return the total time spent running, so I could do this by selecting the maximum time for each routeID... which sounds simple, until you actually try and write the query!

SELECT time, sessionID FROM waypoint ORDER BY time DESC;

...will return all waypoints, ordered by time; so how can I modify this to only return only one row (containing the longest time for that route) for each route?

Thanks :)
Alex
 
Back
Top Bottom