If your table definition looks something like this:
create table test ( id integer, `time` time(3)
You can do it:
select time(sum(`time`)) from test;
Note: mysql 5.6 + required change
In fact, time is the wrong function to use, since it does not have a lot of skills.
use sec_to_time , namely:
select sec_to_time(sum(`time`)) from test;
time retrieves the time value, sec_to_time calculates the time value, i.e. time(70) returns NULL because there is no valid time that has 70 seconds, where sec_to_time will correctly return '00:01:10' for the same input
Turns out I'm still wrong. Let's try to process milliseconds separately until the end of time:
select sec_to_time(sum(time_to_sec(`time`)) + sum(microsecond(`time`))/1000000) from test;
source share