Query that would group records by intervals of 15 min

I’ve got a table in a Sql DB with a column createdDateTime. What I want to be able to do is count how many rows were created between specific but accumulating time periods, ie:
7:00 - 7:15
7:00 - 7:30
7:00 - 7:45
7:00 - 8:00 … and so on until I have the last time group, 7:00 - 18:00.

Is there a nice way to make one query in SQL that will return all the rows for me with all the row counts:
Time Rows Created
7:00 - 7:15 0
7:00 - 7:30 5
7:00 - 7:45 8
7:00 - 8:00 15
… …


syamkuriseti (BOB member since 2012-06-01)

You need a particular running count. look up sql analytic functions (count over partition by etc…)for proper sysntax based on your database.


katullus :us: (BOB member since 2009-08-21)

I think you can get this result by using CASE command in SQL.
Try It it will be good.

Good Luck…
Lionskashif


lionskashif :pakistan: (BOB member since 2011-01-21)