Intenta reemplazar:
SUM(H_TIME) AS HANDLE_TIME
por :
MEDIAN(H_TIME) AS HANDLE_TIME
(línea 3)
EDITAR:Para los meses, reemplace:
select
MONTH, WEEK, DAY,
Por:
select
MONTH,
Y:
GROUP BY
MONTH
,WEEK
,DAY
Por:
GROUP BY
MONTH
Para las semanas, reemplace:
select
MONTH, WEEK, DAY,
Por:
select
MONTH, WEEK,
Y:
GROUP BY
MONTH
,WEEK
,DAY
Por:
GROUP BY
MONTH
,WEEK