troubleshooting Question

help with query

Avatar of HLRosenberger
HLRosenbergerFlag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008SQL
5 Comments1 Solution453 ViewsLast Modified:
I need a query that would cumulatively "count up" the hours for each month.

Data like this:

 
id          client_id           visit_date            visit_hours      
1           10                   1/1/2011 14:00    2.0                  
1           10                   1/21/2011 8:00    5.0                  
1           10                   1/31/2011 9:00    1.0                  
1           10                   2/1/2011 7:00      2.0                  
1            10                  2/25/2011 9:00    3.5                  
 

The resulting data would need to be:
 
id          client_id           visit_date            visit_hours      cumulative_hours        
1           10                   1/1/2011 14:00    2.0                   2.0                                
1           10                   1/21/2011 8:00    5.0                   7.0                          
1           10                   1/31/2011 9:00    1.0                   8.0                          
1           10                   2/1/2011 7:00      2.0                   2.0                            
1            10                  2/25/2011 9:00    3.5                   5.5                            
 
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros