sql server - How do I write some SQL that will return results showing the number of rows that occured in each hourly period? -
I need to present a SQL Report, which, during the day, Reflects. In my table there is a date / time column on which time to event.
How do I count the number of rows that occur during each hour of the day?
So I need to see the output like this ...
10:00 - 11:00 12 times
11.00 - 12:00 53 times
12:00 - 13:00 5 times etc.
I think this will be a group, but how do you group each hour? thank you in advanced.
choose DATEPART (hh, datetime column), COUNT (*) by table name DATEPART According to the order (HH, Datetime column) order, DATEPART (HH, Datetime column)
Comments
Post a Comment