declare @myTable table
(
id bigint identity(1,1) not null primary key clustered
, createdDate date not null
, clicks int not null
)
insert @myTable
select GETUTCDATE() - 00, 9
union select GETUTCDATE() - 01, 6
union select GETUTCDATE() - 02, 5
union select GETUTCDATE() - 03, 9
union select GETUTCDATE() - 04, 3
union select GETUTCDATE() - 05, 6
union select GETUTCDATE() - 06, 3
union select GETUTCDATE() - 07, 6
union select GETUTCDATE() - 08, 9
union select GETUTCDATE() - 09, 9
union select GETUTCDATE() - 10, 8
union select GETUTCDATE() - 11, 7
union select GETUTCDATE() - 12, 1
union select GETUTCDATE() - 13, 2
union select GETUTCDATE() - 14, 5
union select GETUTCDATE() - 15, 3
union select GETUTCDATE() - 16, 8
union select GETUTCDATE() - 17, 7
union select GETUTCDATE() - 18, 4
select DATEPART(week, createdDate) Period
, SUM(clicks) ClickSum
from @myTable
group by DATEPART(week, createdDate)
order by Period