Thread: querying time
View Single Post
  #2  
Old April 20th, 2008, 11:09 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 2,364
Default querying time

SELECT Department
, [Date called]
, Hour([Time Called]) as TheHour
, Count([Time Called]) as CallCount
FROM [Your Table]
GROUP BY Department
, [Date called]
, Hour([Time Called])

In the query design grid,
-- Add your table
-- add Department, Date Called, and Time Called (twice)
-- Change the first time called to
Field: TheHour: Hour([Time Called])
-- Select View: Totals from the menu
-- Change GROUP BY to COUNT under the second instance of [Time Called]
Save the query

If you want you can use this query to build a cross tab query to show
the data.

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


shirl wrote:
I have been given a database, which has been used to record incoming
calls, the user enters the time someone phones in, the department name
and person they were put through to.

They now want to be able to record the number of calls to departments
on an hourly basis and display this in a report, so that they can see
which departments get the most calls.

The report is to display the list of calls by date, department and a
total number of calls to a department between say 09.00 and 10.00,
10.00 and 11.00 and so on.

Fields in the database are, Caller, date called, time called, contact,
department. Time called is short time format.

I'm not sure of the best way to do this, so would welcome suggestions.

Shirl