Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Summing by 24hr period - 7am to 7am

Status
Not open for further replies.

bobfisher

Computer
Jul 22, 2005
1
0
0
GB
OK, I'll try and explain this 'logically':

My MS SQL application records outputs from a production line in real time. If I want to sum an output from a particular production line for a time period (say a month) and group by day, that works fine. The problem is that our 'Days' run from 7am to 7am and I need to sum that period and group by date of the start of our 'day'. I know I could add 0.278'ish to each day in the query, but then the query does not give the correct results between midnight and 7am.

What can I do?
 
Replies continue below

Recommended for you

You could try subtracting 7/24 of a day from each timestamp - this would make 7 am be 12 am, and 6:59 am be 11:59 pm on the day before. Then after you have the "day", add the time back to get the actual time.

Hope this helps!
 
Status
Not open for further replies.
Back
Top