Query Select most recent record

mredmond

Registered User.
Local time
Today, 04:25
Joined
Oct 1, 2003
Messages
32
I have two tables, a Master table and a Details table. In the Master is one record per employee. In the Details table are multiple records for each employee. Each Details record is time and date stamped.

If I query the tables, I get all the records from both tables. How do I query the tables so that I get all the records from the Master and the most recent record (based on the time/date stamps) from the Details?

I appreciate any help that comes my way.
 
You can use a totals query where you "Group By" on the field from the master table and use "First", "Last", "Max", or "Min" for the Date field - whichever one works to get you the most recent record (probably "Last").

If you're not sure what a totals query is, take a look at the help topic in Access.
 
It's not quite as simple as that. You can either use a sub-select or the two query method I've shown in this post:

http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=44957

Essentially, you need one query to find the "max date" of the record you are interested in and a second to pick up the data fields of that record.
 
I am always amazed at the depth of expertise out there.

Thanks for your quick and accurate suggestions. Problem solved!
 

Users who are viewing this thread

Back
Top Bottom