Last record of several employee records

G

Guest

I need a little help with this one. I have an employee training database.
I have employees that attend the same class several times. I need to query
to find the last time they attended a class. I need the most current date so
I can find out how many years it has been since they attended.

Buzz 1/1/2004 Adult CPR
Buzz 7/8/2003 Adult CPR
Buzz 9/3/2002 Adult CPR

Any help would be much appreciated!!
 
S

Steve Huff

OK, assuming the table was called tblWhatever and it was laid out as
follows:

Name Attendance_Date class_name
------- ------------------ ------------
Buzz 1/1/2004 Adult CPR
Buzz 7/8/2003 Adult CPR
Buzz 9/3/2002 Adult CPR

Then the sql would be:

SELECT tblWhatever.name, Max(tblWhatever.attendance_date) AS
MaxOfattendance_date, tblWhatever.class_name
FROM tblWhatever
GROUP BY tblWhatever.name, tblWhatever.class_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

Top