注册 登录
编程论坛 SQL Server论坛

怎样统计时间间隔总数

笑看人生活快乐 发布于 2008-10-28 20:23, 1745 次点击
怎用统计下面一连串时间段中间隔时间(分) 呢?

2008-10-25 10:16:27.000
2008-10-25 10:18:26.000
2008-10-25 10:20:27.000
2008-10-25 10:22:26.000
2008-10-25 10:24:26.000
2008-10-25 10:26:27.000
2008-10-25 10:28:26.000
2008-10-25 10:30:27.000
2008-10-25 10:32:26.000
2008-10-25 10:34:26.000
2008-10-25 10:36:26.000
2008-10-25 10:38:26.000
2008-10-25 10:40:26.000
2008-10-25 10:42:27.000
2008-10-25 10:44:26.000
2008-10-25 11:45:12.000
2008-10-25 11:47:11.000
2008-10-25 11:47:12.000
2008-10-25 11:49:11.000
2008-10-25 11:49:12.000
2008-10-25 11:51:11.000
2008-10-25 11:51:12.000
2008-10-25 11:53:11.000
2008-10-25 11:53:12.000
2008-10-25 11:55:11.000
2008-10-25 11:55:12.000
2008-10-25 11:57:11.000
2008-10-25 11:57:12.000
2008-10-25 11:59:11.000
2008-10-25 11:59:12.000
2 回复
#2
师妃暄2008-10-28 22:05
假设时间这列名为'jhdate',表明为t2
这样写

select IDENTITY(int,1,1) as rowid,hjdate into t3 from t2
select a.hjdate,datediff(mi,a.hjdate,b.hjdate) as jg  from t3 a,t3 b  where b.rowid-a.rowid=1
#3
笑看人生活快乐2008-10-29 08:18
谢谢 ~~~~
1