After running a query I am getting a Column Like one Below in MySQL
TimeDiff
03:45:07
03:28:59
00:36:16
00:59:42
02:44:18
Now I want to Sum up the Time together in the Same Query. A Sample Query is as given below
SELECT timediff(OutTime, InTime) AS TimeDiff
FROM Table1
I tried Sum and SEC_TO_TIME but I am using in the wrong way.
Kindly let me know how to sum up the time to get 11:53:33
SELECT
SEC_TO_TIME(SUM(tbl.TimeDiff)) as TimeDifferent
FROM
(SELECT TIME_TO_SEC(timediff(OutTime, InTime)) AS TimeDiff
FROM Table1) as tbl
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.