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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help for my query

Status
Not open for further replies.

amoney61

Programmer
Oct 20, 2003
6
0
0
IT
Hello, I need help with my query.
I built a db of people who needs to have a medical check each year for their job.
for each name a new date and result is enterd for each yearly check, then based on a query I made a mask who is checking dates and showing an alert one month before the new check.
What I can't do is to "tell" to the query how to choose one entry only for each name and the one with the higher (newest) date.
I someone able to give me a tip?
Thanks
 
try
Code:
Select empname,max(medtestdate)
from medtests
group by empname
having max(medtestdate)<dateadd("m",-1,date())
 
sorry s/b

Code:
Select empname,max(medtestdate)
from medtests
group by empname
having max(medtestdate)<dateadd("m",-1,date())
 
sorry s/b


CODE

Select empname,max(medtestdate)
from medtests
group by empname
having max(medtestdate)<dateadd("m",-11,date())
 
working fine, thanks.
I put some other fields and iif instructions for alerts.
thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top