mysql - How to get total delay from two columns group by day? -
i have table in mysql database named internet 3 columns: id, dropped_at , dropped_to shown in image
how find total delay group date?
well, have tried it's not working here mysql code:
select dropped_at, dropped_to, timediff(dropped_to,dropped_at) delay internet weekday(dropped_at) between 0 , 6 , week (dropped_at) = week (now()) group cast(dropped_to date)
if want total delay each day following query work:
select date(dropped_at) date, sum(timestampdiff(minute,dropped_at,dropped_to)) delayinminutes internet group date order date;
note: delay in minutes
. can change unit like
if want delay in hh:mm:ss
format try following query instead
select date(dropped_at) date, sec_to_time(sum(timestampdiff(second,dropped_at,dropped_to))) delay internet group date order date;
Comments
Post a Comment