how do I run a query to select most recent date(s) from several .

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to write a database for measurement gage calibration record
keeping. There are several gages that I must track all calibration records
for. Every 6 months each gage must be recalibrated, be each gage does not
coincide with the same calibration date. I would like a query that can group
the gages by assigned gage numbers and then select the most recent
calibration date record only. The previous records for that gage are not
needed for the report that I am trying to create.
 
USe a subquery to get the maximum date for each gage, and use that as the
WHERE criterion value.

SELECT GTN.GageID, GTN.GageName, GTN.CalibDate
FROM GagesTableName AS GTN
WHERE GTN.CalibDate =
(SELECT Max(G.CalibDate)
FROM GagesTableName AS G
WHERE G.GageID = GTN.GageID);
 
Back
Top