As part of setting up reports, I have an SQL query that selects the number of orders placed every week:
select datepart(isowk, order_date), count(*)
from orders where year(order_date) = @Year
group by datepart(isowk, order_date), year(order_date)
order by 1
Please note that I use the new format isowkin the function call datepart, as business in Denmark usually uses ISO week numbers.
Running this query with help @Year = 2010gives a result similar to this:
1 5
2 7
3 10
...
53 3
, 2010 , , , 53 . , 53 2009 . , , , . , 53, "" 2009 .
WHERE, , 1 (52 53) , @Year?