Получить столбец сумма времени в SQL server
I want to sum totalhr column Datatype is time(0)
totalhr 00:00:00 00:53:19 00:00:00 00:00:00 08:08:54 08:20:50 00:00:00 00:00:00 00:00:00 00:00:00 09:20:22 09:52:30 00:00:00 00:00:00 10:06:37 10:19:06 10:05:14 00:00:00 09:21:39 09:33:38 00:00:00 10:19:28 09:35:24 10:33:03 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00
It giving wrong output 112:53:04 the right answer should be 116:30:04
Что я уже пробовал:
выберите cast(sum(datediff(second,0,totalhr))/3600 as varchar(12)) + ':' +
right('0' + cast(sum(datediff(second,0,totalhr))/60%60 as varchar(2)),2) +
':' + right('0' + cast(sum(datediff(second,0,totalhr))%60 as varchar(2)),2) as total
Из checkinout где год(дата)=2019 и месяц(дата)=09 и userid=5