title: How do I get the most recent records based on as of date?
body: <p>I have the following table:</p>
  
  <pre><code>+------------------------------------+
  |     Number  Name     Date          |
  +------------------------------------+
  | 1   1050    Name1    2015-01-01    |
  | 2   1051    Name2    2015-04-27    |
  | 3   1057    Name3    2015-04-27    |
  +------------------------------------+
  </code></pre>
  
  <p>How should I get the most recent records? I've tried something like:</p>
  
  <pre><code>SELECT number, name, MAX(DATE) AS recent_date
  FROM Recent_Table
  HAVING recent_date &lt; '2015-05-19'
  GROUP BY number, name
  </code></pre>
  
  <p>I'm expecting to get the most recent records but instead I'm getting all three because of my having clause. Is there a way to work around this while still keeping my <code>having</code>? Thanks.</p>
  
  <p>Expected output would be:</p>
  
  <pre><code>  1051    Name2    2015-04-27
    1057    Name3    2015-04-27 
  </code></pre>