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

enter image description here

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

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -