Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 week count

Author  Topic 

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-07-08 : 10:39:14
Is their a way to create a table that will do a rolling week count starting with 1/1/2007.

examble it is now week 26 ending 6/28/2008
I would want a column that shows the # 26 tying to 6/22/2008 - 6/28/2008.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-08 : 10:40:34
Huh!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-08 : 10:42:04
make use of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519&SearchTerms=F_TABLE_DATE


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-07-08 : 11:44:48
How do you get week count of 26 for 2008/6/28 if you are starting from 2007/1/1? I would expect week 78.


select [Week Count] = (datediff(day,'20070101','20080628')/7)+1


Results:
Week Count
-----------
78




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -