Counting Ocurrances within a Time Frame

G

Gringarlow

I need to find each time a code occurs 5 or more times in a 7 day period.
Example:
CodeA and Town are fields in tblHelpr that I add rows of data to every
morning.
My query will run after the table is updated.
If CodeA occurs in a specific Town 5 or more times in the last 7 days, I
need to see that in my query.
 
J

Jerry Whittle

SELECT tblHelpr.Town,
tblHelpr.CodeA,
Count(tblHelpr.CodeA) AS CountOfCodeA
FROM tblHelpr
WHERE tblHelpr.TheDate > Date()-7
GROUP BY tblHelpr.Town,
tblHelpr.CodeA
HAVING Count(tblHelpr.CodeA>5;

You didn't say the date field name so change TheDate to the proper field name.
 

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

Similar Threads


Top