How to sum time format (hh:mm:ss.ms) in mysql [duplicate]

Solution 1:

By design, time_to_sec() loses the fractional seconds. On the other hand, sec_to_time() is capable of properly handling fractional seconds.

One solution is to sum the fractional seconds separately, like, then add them back before converting back to a time:

sec_to_time(sum(time_to_sec(timeduration)) + sum(microseconds(timeduration)) / 1000000)