Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Frequency by date query

Status
Not open for further replies.

rswebscan

IS-IT--Management
May 13, 2002
18
US
I have a data base that contains records with an ID number and appearance date. Each ID number may appear multiple times in the database. I need to refine a query so that I have a resulting table that contains an ID number that appears more than say 12 times AND with appearance dates within the last 2 to 3 years. I need to reduce my database so I can contact people with appearance frequency and a recent appearance.

My database format is &quot;ID Number&quot;,&quot;Appearance Date&quot; <EOR>
the date format is MMDDCCYY. The dates can be up to 50 years ago.

I can query the table to get the number of dups for each ID number but I can't figure out how to further add the date check variable into my query.

Thanks!...Rick
 
See having If what you want is
&quot;12 times AND with appearance dates within the last 2 to 3 years&quot;

SELECT idnumber, Count(idnumber) AS CountOf
FROM yourtable
WHERE Year([Appearance Date])>2000
GROUP BY idnumber;
HAVING Count(idnumber))>12
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top