如何用SQL计算时间总和? [英] How to calculate the sum of time with SQL?
本文介绍了如何用SQL计算时间总和?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I want to calculate the sum of following time fields with a sql query:
02:35
11:15
00:15
Result should be 14:05
How to do this with sql query?
我尝试过的事情:
我不知道该怎么做........................................... ..................
What I have tried:
I don''t know how to do this..........................................................
推荐答案
使用以下查询
Use following query
SELECT DATEADD(ms, SUM(DATEDIFF(ms, ''00:00:00.000'', YourFieldName)), ''00:00:00.000'') as time FROM YourTableName
这篇关于如何用SQL计算时间总和?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文