1

运行查询后,我在 MySQL 中得到如下列

TimeDiff
03:45:07
03:28:59
00:36:16
00:59:42
02:44:18

现在我想在同一个查询中一起总结时间。示例查询如下所示

SELECT timediff(OutTime, InTime) AS TimeDiff
  FROM Table1 

我尝试了 Sum 和 SEC_TO_TIME 但我以错误的方式使用。

请让我知道如何总结获得 11:53:33 的时间

4

1 回答 1

1
SELECT
  SEC_TO_TIME(SUM(tbl.TimeDiff)) as TimeDifferent
FROM
  (SELECT TIME_TO_SEC(timediff(OutTime, InTime)) AS TimeDiff
   FROM Table1) as tbl
于 2013-06-22T04:39:53.910 回答