I have a query that consists of the following fields:
ID (int)
Code (varchar)
ServiceDate (date, such as 1/15/2025)
Hours (int such as 1, 0.25, 1.75...)
What I need to have happen is the Hours being added for each consecutive 7 days. One issue I'm having is that there are missing days here and there.
So a sample of the current data being pulled looks like this (I've included the desired output in the 7,14, and 21 day columns:
ID Code DOS TotHours 7 days 14 days 21 days
123    H5    1/15/2025    1               1               0                 0
123    H5    2/10/2025    0.25          1.75         2.25              4.25
123    H5    2/13/2025    1               2.75         4                 1.25
123    H5    2/14/2025    0.5
123    H5    2/17/2025    1
123    H5    2/19/2025    0.25|
123    H5    2/21/2025    1
123    H5    2/24/2025    1
123    H5    2/25/2025    1
123    H5    2/26/2025    1
123    H5    2/27/2025    0.25
123    H5    2/28/2025    1
Can this be done without complicated indexing?
 
 

