在SQL Server中,可以使用DATEPART,然后按小时,分钟和第二整数除法10进行分组。
CREATE TABLE #times( thetime time, A int)INSERT #timesVALUES ('10:00:01', 2)INSERT #timesVALUES ('10:00:07', 4)INSERT #timesVALUES ('10:00:10', 2)INSERT #timesVALUES ('10:00:17', 1)INSERT #timesVALUES ('10:00:18', 3)SELECt avg(A) -- <-- here you might deal with precision issues if you need non-integer results. eg: (avg(a * 1.0)FROM #timesGROUP BY datepart(hour, thetime), DATEPART(minute, thetime), DATEPART(SECOND, thetime) / 10DROP TABLE #times


