Hi Guys hope you had great holidays, I have a script that looks at all the flights in a table based upon a members number then adds all of their time up sounds simple and its working great, however when I go to order my results by total wich is really the time I get well a pretty random result. Confused? I am 🙂 Instead of listing the highest hours at the top it simply looks at the first digit ie. 1 as aposed to 1001 and im not sure how to fix this.
Here is an example of the query
SELECT Distinct(pilot_id) as person, sec_to_time(sum(time_to_sec(time))) as total FROM allflights group by person order by total DESC;
I have also made a test page for you to view I have hilighted the person with the most hours in green for quickness. and echo the query for your reference on the page also.
I have looked around for a solution but have been unable to locate anything of use.
Thanks for taking the time to look at this
Kind regards
Lee