sql - MySQL Sum based on date range and time of day -
There is a large group of data collected every 15 minutes I have to select data between a certain time period I am trying and after that period of time I am dividing it by another date interval. And within a few intervals the zodiac sign during a certain period.
For example, I would like to be able to select data between 01/01/2009 and 01/01/2010 and the group from 01/01/2009 - 05/01/2009, 05 / 02/2009 - 11/01/2009, 11/02/2009 - 01/01/2010 and then choose the time data within each group 00:00:01 - 12:00:00 and 12:00:01 - 23.:9: 59
SE sum SUM (Data.usage) data from AS sum.meter_id = Meter.id WHERE Data.start_read & gt; = '2009-01-01' and Data.end_read & lt; = '2010-01-01 23:59:59'
Date range by group? Not sure how to separate the data based on the date range, I often use case statements:
group case starts between '01 / 01/2009 'and '05 / 01/2010' January-April 09 'When '05 / 01/2009' and '11 / 2010 'starts between' May-November 09 '... etc ...
Comments
Post a Comment