title: SQL Server: SELECT only the rows with MAX(DATE)
body: <p>I have a table of data (the db is MSSQL):</p>
  <pre><code>ID  OrderNO  PartCode  Quantity DateEntered
  417 2144     44917     100      18-08-11
  418 7235     11762     5        18-08-11
  419 9999     60657     100      18-08-11
  420 9999     60657     90       19-08-11
  </code></pre>
  <p>I would like to make a query that returns OrderNO, PartCode and Quantity, but only for the last registered order.</p>
  <p>From the example table I would like to get back the following info:</p>
  <pre><code> OrderNO  PartCode  Quantity     
   2144     44917     100      
   7235     11762     5        
   9999     60657     90  
  </code></pre>
  <p>Notice that only one line was returned for order 9999.</p>
  <p>Thanks!</p>