How can i counting and grouping every 2 hours ?
i have a table like this:
Id TheTime
-- -------
1 07/07/2012 08:49:02
2 07/07/2012 09:36:39
3 07/07/2012 10:36:39
4 07/07/2012 12:36:39
5 07/07/2012 13:36:39
how can i convert into :
TheTime_08_10 TheTime_10_12 TheTime_12_14 etc.. until TheTime_22_00
------------- ------------- ------------ -------------
2 1 2
Thanks you in advance,
Stev
For a database which supports Hour() function, you can use:
You will get something like this:
The first column is the starting hour –
8means time from 8:00 to 9:59, etc.