本文介绍了Sql 2008:连接两个或多个字符串并在单个记录中显示它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个日期时间列,我想添加然后从开始到结束显示所有时间作为一条记录:



例如:

I have a column with date-time and i want to add then display all the time from the start till the end as one record:

For example:

DelayTime:
1900-01-01 02:30:50.000
1900-01-01 03:20:10.000
1900-01-01 02:40:00.000
1900-01-01 00:10:00.000
1900-01-01 03:00:00.000
1900-01-01 06:20:00.000
1900-01-01 05:00:00.000
1900-01-01 01:00:00.000
1900-01-01 01:59:20.000
1900-01-01 00:04:00.000
1900-01-01 00:60:00.000
1900-01-01 00:30:00.000
1900-01-01 08:00:00.000
1900-01-01 09:30:00.000
1900-01-01 10:00:00.000
1900-01-01 03:35:00.000

Then Display as:

DelayTime:
The total time of Delaye
00:00:00

只有,有可能吗?

推荐答案

SELECT DATEDIFF(second,CAST('02:32:00' AS DATETIME)
, CAST('03:40:00' AS DATETIME))/60.0 AS MIN_DIFF;





然后用hh执行所有分钟的总和:mm:ss then使用: -





Then to do sum of all minutes in hh:mm:ss then use:-

SELECT CONVERT(CHAR(8), DATEADD(Minute,convert(int, 68), ''00:00:00''), 108)



这篇关于Sql 2008:连接两个或多个字符串并在单个记录中显示它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 13:25