title: GROUP BY having MAX date
body: <p>I have problem when executing this code:</p>
  
  <pre><code>SELECT * FROM tblpm n 
  WHERE date_updated=(SELECT MAX(date_updated) 
  FROM tblpm GROUP BY control_number 
  HAVING control_number=n.control_number)
  </code></pre>
  
  <p>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.</p>
  
  <p>Is there any other sql clause or command that can execute faster than the query above?</p>
  
  <p>Thanks in advance.</p>