la suma:
Código SQL:
Ver originalCREATE TABLE #temp
(
DATE datetime
)
DELETE FROM #temp
INSERT INTO #temp VALUES ('06-09-2012 1:02:23')
INSERT INTO #temp VALUES ('06-09-2012 0:02:38')
INSERT INTO #temp VALUES ('06-09-2012 0:00:44')
INSERT INTO #temp VALUES ('06-09-2012 0:00:59')
INSERT INTO #temp VALUES ('06-09-2012 0:04:56')
INSERT INTO #temp VALUES ('06-09-2012 0:12:41')
SELECT
CASE WHEN
SUM(datepart(mi,DATE)) + SUM(datepart(ss,DATE))/60 > 60 THEN
SUM(datepart(hh,DATE)) + SUM(datepart(mi,DATE))/60 ELSE SUM(datepart(hh,DATE)) END AS horas,
CASE WHEN
SUM(datepart(ss,DATE))>60 THEN
SUM(datepart(mi,DATE)) + SUM(datepart(ss,DATE))/60 ELSE SUM(datepart(mi,DATE))%60 END AS minutos,
CASE WHEN
SUM(datepart(ss,DATE))>60 THEN
SUM(datepart(ss,DATE))%60 ELSE SUM(datepart(ss,DATE)) END AS seg
FROM #temp
ahora el promedio....como lo obtienes promedias que? minutos, segundos, horas?