php - Count overall time between two timestamps per user -
currently i'm stuck mysql queries. have table this:
id|userid|username|starttime|endtime|committype the users click buttons in frontend -> start <- , -> stop <-. creates db entry respective duties, starttime , endtime. so, each click on start creates new row/entry in db , finished click on stop button.
my problem, there chance count overall time between start time , end time per user , commit type?
this work
select userid, committype, min(starttime), max(endtime), sum(time_to_sec(time_diff(endtime - starttime))/3600) hours tablename group userid, committype
Comments
Post a Comment