I have a database that I need to sum 2 values using the datetime column. Example:
Date Offered
4/16/2012 08:00:00 2
4/16/2012 08:30:00 18
4/16/2012 09:00:00 14
4/16/2012 09:30:30 42
I need to sum the values of 08:00:00 with 08:30:00 (total: 20) and 09:00:00 with 09:30:00 (total: 56) and so on.
This should work for you
You need to group by both the hour and the date if you want it summed by individual day, otherwise you’ll include other days (IE April 15 etc…)