I have problem when executing this code:
SELECT * FROM tblpm n
WHERE date_updated=(SELECT MAX(date_updated)
FROM tblpm GROUP BY control_number
HAVING control_number=n.control_number)
Basically, I want to return the most recent date for each control number. The query above returns correct output but it takes 37secs. before the output was shown.
Is there any other sql clause or command that can execute faster than the query above?