Как группа за неделю (7 дней) в SQL Server
SELECT
CONVERT(VARCHAR(5), DATEADD(WK, WK, 0), 103) + ' - ' + CONVERT(VARCHAR(5), DATEADD(DD, 6, DATEADD(WK, WK, 0)), 103)
, Cnt
FROM (
SELECT
DATEDIFF(WK, 0, MyDate) AS WK
, COUNT(*) AS Cnt
FROM (VALUES
('2013-01-01')
, ('2013-01-02')
, ('2013-01-03')
, ('2013-01-04')
, ('2013-01-05')
, ('2013-01-06')
, ('2013-01-07')
) AS X(MyDate)
GROUP BY DATEDIFF(WK, 0, MyDate)
) AS X
Mappy Show