Detta borde göra susen:
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
Detta borde göra susen:
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