This is part of a long query which compute the total time per day. I want to change it to give me the total time per week. Any idea? To check the long query click Here
INSERT INTO @test (
activity
,DATE
,TimePerDay
)
SELECT activity
,Cast(starttime AS DATE) AS DATE
,SUM(datediff(second, starttime, endtime)) / 60.0 AS TimePerDay
FROM cte WITH (NOLOCK)
WHERE starttime >= dateadd(week, @LastXWeeks, last_update)
GROUP BY activity
,cast(starttime AS DATE)
Aucun commentaire:
Enregistrer un commentaire