I have a table with 2 columns - Date, ItemsSold. I have the following query
Select datepart(week, [Date]) as WeekNo, SUM([ItemsSold]) as Total From [table]
group by datepart(week, [Date])
This gives the following output
WeekNo Total
3 20
4 30
What I actually need is an output as follows
WeekOf Total
11 Jan 2015 20
18 Jan 2015 30
How do I get the start date of the week that datepart returns?
Aucun commentaire:
Enregistrer un commentaire