Need to return only the maximum record

ya5irha55an

Registered User.
Local time
Today, 16:56
Joined
Sep 20, 2005
Messages
20
My quiery is supposed to search through a table of names, and find the latest timesheet entry date for each name, as follows:

ID: 1
Name: John
Timesheetdate: 1/1/2005

ID is specific to each name.

I want the result to be a single row for each ID/name, and to return ONLY the latest timesheetdate (this could either be the maximum value or the latest entry).

I have a feeling that this is a simple problem, but i just dont have the knowledge to do it, any help would be greatly appreciated!
 
I assume that a given ID/Name can have multiple entries, but am confused by the statement
(this could either be the maximum value or the latest entry).
you either want the max or last date, which may coincide, if you want the max then use Max on the total row of the query grid else if you want the last row entered/updated use Last. Groupby for ID and Name.

Brian
 
Thanks for the response Brian!

I understand the part about selecting max on the totals row, but im not sure about the 'group by' bit, what does this mean and how do i do it?
 
When you open up the Totals row in the query grid the option usually defaults to Group By else select it from the drop down ( click on the Total row field).Group By means exactly what it says, you will get one record for each field ie ID/Name combination in your case, plus the Max value of the date field for that combination.

Brian
 
If your new to ACCESS you may need to read about aggregate functions which appear in the Total row, confusing hey. Type aggregate functions in the help answer wizard search, the first topic returned will be ' About calculations in a query' , that's what you need to read.

Brian
 

Users who are viewing this thread

Back
Top Bottom