Query group by hours (1 Viewer)

cocowomble

Registered User.
Local time
Today, 00:44
Joined
May 25, 2014
Messages
25
Hi all.
Would appreciate any help possible, for what I would guess to be a simple question to the right person.

I have a table with a list of records, each record has a time

From this I have a query, what I would like the query to do, is group the records in the query by hours.

Firstly is this possible, and if so, how do I do it.


Thanks in advance.
 

plog

Banishment Pending
Local time
Today, 02:44
Joined
May 11, 2011
Messages
11,669
You would first create a calculated field to determine the hour of each time using the Hour function (http://www.techonthenet.com/access/functions/date/hour.php). It would look like this:

HourOccured: Hour([YourTimeFieldHere])

Also, to GROUP BY, this needs to be an aggregate function, so be sure the Sigma/Summation symbol in the ribbon is clicked. Underneath every field a 'Group By' will appear.

Beware though, every field you GROUP By creates a "unique" record in the query. If you get more results than you expect the issue is probably including fields you shouldn't be GROUPING BY.
 

Users who are viewing this thread

Top Bottom