Grouping by 30 minute period

G

Guest

I have a table containing data that is time stamped in the format
3:08:00 PM etc

This table contains numerous records that span across a 24 hour period. I
need to be able to count records in 30 minute increments....ie how many
records between 7:00AM & 7:30AM, 7:30AM & 8:00AM etc

If anyone can assist in this regard it would be very much appreciated. Thanks

Richard
 
M

Marshall Barton

RichardLOZ said:
I have a table containing data that is time stamped in the format
3:08:00 PM etc

This table contains numerous records that span across a 24 hour period. I
need to be able to count records in 30 minute increments....ie how many
records between 7:00AM & 7:30AM, 7:30AM & 8:00AM etc

You can use the expression:

DateValue(stamp) + TimeSerial(Hour(stamp), 30 *
(DatePart("n", stamp) \ 30), 0)
 
G

Guest

Marsh

Thanks for the quick reply, but I still dont get it. I am not all that
familiar with access and the way it does queries and its expressions. if you
could be a bit more specific or indeed simple it would be very much
appreciated. Cheers

Richard
 
M

Marshall Barton

Well, this is a query newsgroup so I guess you want a query?

SELECT DateValue(stamp) + TimeSerial(Hour(stamp), 30 *
(DatePart("n", stamp) \ 30), 0) AS Stamp30, Count(*) As
RecCount
FROM thetable
GROUP BY DateValue(stamp) + TimeSerial(Hour(stamp), 30 *
(DatePart("n", stamp) \ 30), 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top