I've got the following tables:
devices table
SN tested_device_id test_setup_id
129 6 103
129 7 104
130 8 106
test_setup table
test_setup_id data1
103 111
104 333
106 555
I want to deliver SN, test_setup_id, data1 for the last instance of each
serial number as follows:
129,104,333
130,106,555
(Omitting the earlier copy of SN 129).
I have a query as follows which deliver both records for SN 129 and don't know how to condition it to only deliver the last of them:
SELECT sn,
test_setup_id,
data1
FROM test_setup
INNER JOIN devices
ON test_setup.test_setup_id = devices.test_setup_id
Any assistance would be welcomed. Thank you.