mysql - How can I calculate the difference between different times -
hope today.
i need in case, need each day, each taxiid, sum of hours worked passengers ( ent_pickup_time, ent_dropoff_time) , without passengers, ( ent_requested time, ent_dropofftime). example taxi 003001 in day march 3 of 2015 worked 3 hours passenger , 3 hours , half without passenger. have tried million queries, , no 1 of them worked far :(
my last query :
select substring(hex(ent_id), 1, 3) fleetid, substring(hex(ent_id), 4, 16) taxiid, (ent_requested_time), (ent_pickup_time), (ent_dropoff_time) , (ent_fare), (ent_distance), sec_to_time(sum(time_to_sec(ent_dropoff_time) - time_to_sec(ent_pickup_time))) con_pasajero, sec_to_time(sum(time_to_sec(ent_pickup_time) - time_to_sec(ent_requested_time))) sin_pasajero tf_entities date(`ent_requested_time`) = '2015-03-03' group 'fleetid', taxiid asc order taxiid asc
in query have manually sum time differences in day, want automatize date-hour thing.
my wished result this, ordered date , taxiid, example:
id|taxi_id| date |time_wihtout_passenger|time_with_passenger| total_time | 03|003001|2015-3-3| 00:30:00 | 01:02:00 | 01:32:00 ent_fare_total | ent_distance_total | 40,000 | 20,000
the time without passenger difference between ent_requested_time , ent_pickup_time , time passenger ent_pickup_time , ent_dropoff_time. total time sum of 2 of them.
Comments
Post a Comment