0

I have a table where data will be Inserting every 15 min. so time stamp will be as follows

table Name: tblresultset

ID      Date               count  
 1   2017-05-03 1:15:00     10
 2  2017-05-03 1:16:00      11
 3   2017-05-03 1:27:00      2
 4   2017-05-03 1:28:00      3
 5   2017-05-03 1:29:00      6
 6   2017-05-03 1:30:00      8 
 7   2017-05-03 1:31:00      2
 8   2017-05-03 1:32:00      1
 9  2017-05-03 1:33:00       2

Now I am looking for the query which will get me the total count from 
2017-05-03 1:15 to 2017-05-03 1:30 

I have to get this kind of count for each 15 min interval on the given date.

Could anybody help me out please?

Sloan Thrasher
  • 4,953
  • 3
  • 22
  • 40
user957178
  • 631
  • 4
  • 15
  • 27
  • You want `1:15` to `1:30`, then `1:30` to `1:45`,....? – TriV May 05 '17 at 03:05
  • Are you looking for a specific interval (ie. 017-05-03 1:15 to 2017-05-03 1:30), or do you want all the data grouped by 15 minute intervals? – Blue May 05 '17 at 03:05

1 Answers1

0

Use group by and datediff:

GROUP BY DATEDIFF(MINUTE, '1990-01-01T00:00:00', date) / 15

See this post for more info.

Blue
  • 22,608
  • 7
  • 62
  • 92