Dette burde gøre tricket:
SELECT
UID,
DATEADD(d, -1, DATEDIFF(d, -1, t.DT)/7 * 7) [WeekBeginDate] ,
SUM(HOURS) AS TOTAL_HOURS
FROM myTable t
WHERE DT >= DATEADD(WEEK, -6, GetDate())
GROUP BY UID, DATEDIFF(d, -1, t.DT)/7
Dette burde gøre tricket:
SELECT
UID,
DATEADD(d, -1, DATEDIFF(d, -1, t.DT)/7 * 7) [WeekBeginDate] ,
SUM(HOURS) AS TOTAL_HOURS
FROM myTable t
WHERE DT >= DATEADD(WEEK, -6, GetDate())
GROUP BY UID, DATEDIFF(d, -1, t.DT)/7