Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2006
    Posts
    11

    Help with Time Intervals

    Hello --

    I am trying to write a query where it lists the total for all the events that take place during each hour of the day (00:00 - 23:00). I have a time field that lists what time the event took place.

    Example if I had events taking place at 1:15, 23:30, 14:43, and 1:30 the query would list

    Time/No. of Events
    00:00/0
    01:00/2
    02:00/0
    03:00/0
    .....
    13:00/0


    14:00/1
    15:00/0
    .....
    22:00/0
    23:00/1

    Any help you could provide would be greatly appreciated.

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Try:

    SELECT Hour([TimeField]) AS TheHour, Count([TimeField]) AS NumEvents
    FROM YourTable
    GROUP BY Hour([TimeField])
    ORDER BY Hour([TimeField])

  3. #3
    Join Date
    Feb 2006
    Posts
    11
    Works Great, thank you

  4. #4
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    You're welcome

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums