[英]Calculating total time duration in MySQL
i have a table data like this 我有这样的表数据
(int) (time) [mySQL datatype]
Id Duration
------------------
1 00:10:00
2 10:10:00
3 03:00:00
4 04:13:00
i want to calculate the total duration from this table, how can we do it. 我想从这张表中计算总持续时间,我们该怎么做。 like 17:33:00. 喜欢17:33:00 Could anybody please provide mysql query to calculate this. 有人可以提供mysql查询来计算这个。
Try converting to seconds, summing, then converting back to a time: 尝试转换为秒,求和,然后转换回时间:
SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(Duration)))
FROM Table1
Result: 结果:
17:33:00
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.