How can i select the latest records from a table for each invidual equipment thats due calibration within 14

Equipment_id | Date_of_last_Calibration | Calibration_Cycle | Calibration_Due_Date
test 10/02/2011 Annual 10/02/2012
test 10/02/2010 Annual 10/02/2011
test2 10/10/2011 Annual 10/10/2013
test3 08/02/2010 Annual 08/02/2011


I can select all records for calibration due within 14 days using

SELECT * FROM equipment_calibration WHERE `Calibration_Due_Date`<= ADDDATE(CURDATE(), INTERVAL 14 DAY)

but i cant limit it to display the latest records only ie

i want it to show that Equipment_id "test" that is due calibration in next 14 days but not the "test" that was last due calibration on a year ago, that was then calibrated

SHOW THIS
test 10/02/2011 Annual 10/02/2012
HIDE THIS
test 10/02/2010 Annual 10/02/2011

Try

SELECT *, MAX(Calibration_Due_Date) FROM equipment_calibration WHERE `Calibration_Due_Date`<= ADDDATE(CURDATE(), INTERVAL 14 DAY)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.