Return the Latest Record for Each Serial Number in Microsoft Access
Question details
Return one complete assessment record for each serial number based on the latest assessment date or the largest AutoNumber ID.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- An assessment table contains multiple records for each serial number, and the user needs the newest record for each one.
- Observed behavior
- The desired result is one complete row per serial number, with the ID resolving any ties on the latest date.
Open the database in Access and identify the table name, serial number field, assessment date field, and unique AutoNumber field. Replace the example names in the SQL with your actual names, and decide whether the assessment date or the largest ID defines the newest record.
Return the latest assessment date with an ID tie-breaker
Use this method when the assessment date determines the latest record and the largest ID should resolve date ties.
The first query finds the latest assessment date for each serial number. The second joins those results to the original table and selects the largest ID when multiple records share that date.
In Access, select Create > Query Design, switch to SQL View, and enter: SELECT [SerialNumber], Max([AssessmentDate]) AS LatestDate FROM Assessments WHERE [SerialNumber] Is Not Null AND [AssessmentDate] Is Not Null GROUP BY [SerialNumber];
Select Save and name the query qLatestAssessmentDate. Replace Assessments and the field names in the SQL if your database uses different names.
Create another query in SQL View and enter: SELECT A.* FROM Assessments AS A INNER JOIN qLatestAssessmentDate AS Q ON (A.[SerialNumber] = Q.[SerialNumber]) AND (A.[AssessmentDate] = Q.[LatestDate]) WHERE A.[ID] = (SELECT Max(B.[ID]) FROM Assessments AS B WHERE B.[SerialNumber] = A.[SerialNumber] AND B.[AssessmentDate] = A.[AssessmentDate]);
Select Run and verify that the results show one row per serial number and include all fields from the matching assessment record.

Return the record with the largest AutoNumber ID
Use this method when the largest ID, rather than the assessment date, defines the record you want.
Review exported assessment records in WPS Spreadsheets
WPS Office is a free, lightweight, easy-to-use alternative for working with spreadsheet exports. Its familiar interface and Microsoft Office format compatibility make it easy to move existing files, although it does not run or repair Microsoft Access queries.

Frequently Asked Questions
Why does a maximum-date query return more than one row per serial number?
A join on serial number and date returns every record that shares the latest date. Add the maximum ID tie-breaker shown in the complete-record query to select one row.
Can I return all fields from the latest assessment record?
Yes. Join the saved maximum-date query back to the assessment table, then use SELECT A.* to return all fields from the matching table row.
What happens if an assessment date is blank?
The date-based example excludes blank dates with [AssessmentDate] Is Not Null. A serial number with no dated records will not appear in that query's results.
Should I use the latest date or the largest AutoNumber?
Use the date-based query when assessment date determines recency. Use the largest-ID query only when the largest AutoNumber is the intended definition of the latest record.
Does the date-based query consider the time of day?
Yes. If AssessmentDate contains both a date and a time, Max uses the complete date and time value. Records on the same calendar day can therefore have different values.




