Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group by HOUR? Is it possible? 1

Status
Not open for further replies.

Rmcta

Technical User
Nov 1, 2002
478
US
I need to count how many records I have per hour.
Example of my time field:
5:26:46 PM
12:38:28 PM
10:38:16 AM

How do I do that?
I need to know how many record I have from 6 to 8 am and then from 8 to 9 am ..and so on.

Thank you very much
 
I assume you have a date/time field:

select hour([mydatetime]),count(*)
from mytable
group by hour([mydatetime])

Note: hours after 12PM will be in military format, e.g. 10PM is 22, etc.

Mike Pastore

Hats off to (Roy) Harper
 
You are GREAT! [2thumbsup] Thank you very, very much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top