From: rodchar on
Hi All,

Given:
year = 2009
week = 3

How would I build a temp table of year/week values 27 weeks back.

for the example above:

2009, 3
2009, 2
2009, 1
2008, 52
2008, 51
....

(Also, doesn't some years have 53 weeks?)

thanks,
rodchar
From: rodchar on
About the 53/54 week issue is no longer an issue. 2008, 52 will work fiine.

"rodchar" wrote:

> Hi All,
>
> Given:
> year = 2009
> week = 3
>
> How would I build a temp table of year/week values 27 weeks back.
>
> for the example above:
>
> 2009, 3
> 2009, 2
> 2009, 1
> 2008, 52
> 2008, 51
> ...
>
> (Also, doesn't some years have 53 weeks?)
>
> thanks,
> rodchar
From: Plamen Ratchev on
You can create a calendar table and pull any number of weeks you want:
http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html

--
Plamen Ratchev
http://www.SQLStudio.com
From: rodchar on
got it, thanks Plamen.

rod.

"Plamen Ratchev" wrote:

> You can create a calendar table and pull any number of weeks you want:
> http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com
> .
>