Re: Need help with query William wrote:
>
> I am trying to write a query that will capture data for a particular
> date range and then group the data by week to be graphed. The script
> below works well now but it will not be correct starting in January
> because I am adding the number of weeks for the date. So in January
> the dates in December will be around 50 so when I add that to the
> first Monday of the year it will come back with December of 2004
> instead of December 2003. I can not think of any way around this,
> does anyone have a better solution? Any help would be great...
I'm not sure if I understand you correctly, but it looks to me
that you just need to group by the year and the week of the
year. Something like datepart(yy, date) and datepart(wk, date).
That would give you results like -
2003, 7
2003, 9
2003, 37
3004, 1
etc.
Is that what you want?
-am © 2003 |