Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Max Date Qry

Max Date Qry

Max Date Qry

My database contains inspection data for inspections done on food facilities in the area.

My task is to build a report that will show: FacilityID, InspectorID, Last InspectionDate. The following sql works, but when I add the InspectorID, it no longer shows the last inspection date, but all inspections done for each facility.

SELECT Inspections.FacilityID, Max(Inspections.InspectionDate) AS MaxOfInspectionDate
FROM Inspections
GROUP BY Inspections.FacilityID;

What am I missing?

Thank you to all the help that may come my way from all you great gurus!

RE: Max Date Qry

The simple way is to use two queries. The first is as you have created. Then join your totals query to the Inspections table on FacilityID and InspectionDate. This can be done in a single query but it's not something I want to try with "air code".

Hook'D on Access
MS Access MVP 2001-2016

RE: Max Date Qry



Thank you, works like a charm....

RE: Max Date Qry

That also depends on what you mean by "add the InspectorID"?
If you add it to your SELECT portion, did you add it to the GROUP BY portion as well?

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close