If my records are like below with 4 columns Criteria, value, startdate, enddate
. From the available startdate
I need to group values with time interval.
If startdate
is 8.56 and interval
is 10 mins, then I need to group records from 8.56 to 9.05)
criteria Value startdate EndDate
exceptions 5 2017-12-13 08:56:00.000 2017-12-13 09:00:00.000
exceptions 2 2017-12-13 09:01:00.000 2017-12-13 09:05:00.000
exceptions 1 2017-12-13 09:06:00.000 2017-12-13 09:10:00.000
exceptions 3 2017-12-13 09:11:00.000 2017-12-13 09:15:00.000
exceptions 1 2017-12-13 09:16:00.000 2017-12-13 09:20:00.000
I would like to group the records on required time interval like 10 minutes, 12 minutes and 15 minutes.
If the interval in 10 minutes, then the result should be like below, (aggregation- sum (value))
exceptions 7 2017-12-13 08:56:00.000 2017-12-13 09:05:00.000
exceptions 4 2017-12-13 09:06:00.000 2017-12-13 09:15:00.000
exceptions 1 2017-12-13 09:16:00.000 2017-12-13 09:20:00.000
How do I achieve this ?