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
 Calculate sum of hours from weekly bases?

Author  Topic 

getur.srikanth@gmail.com
Yak Posting Veteran

77 Posts

Posted - 2011-05-09 : 10:08:14
I need to find the maximum date for that particular client and store id, that will be treated as latest date (or current date). Then, From there I need to go back 52 weeks to 27 weeks and calculate sum(hours). And 26 Weeks to latest date (or current date) and calculate sum(hours).


ClientID StoreID period hours
1 10 2010-04-19 8.04
1 10 2010-04-20 6.24
1 10 2010-04-21 8.26
1 20 2010-04-22 7.94
1 20 2010-04-23 22.43
1 20 2010-04-24 22.99
2 5 2010-12-19 130.67
2 5 2010-12-26 159.26
2 5 2011-01-02 113.59
2 5 2011-01-09 12.66
2 8 2011-01-16 22.34
2 8 2011-01-23 11.35


Please let me know how to calculate this? If you have question ask me.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-05-09 : 10:14:31
Duplicate: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=160301
Go to Top of Page
   

- Advertisement -