[Solved] I want to set data from following table group by Weeks in SQL


For the week number you can use PARTDATE() function,
So you query should be :

select partdate(WK,r.date) numweek, sum(r.sales) totsales 
from yourtable r
group by partdate(WK,r.date)

Take a look please at Get week number from dates in T-SQL

You can also subtruct an N numeric value from partdate(WK,r.date) and then beware of group by clause, to start your selection of weeks with 1.

Hope this can help you

0

solved I want to set data from following table group by Weeks in SQL