title: SQL: Return ID for the most recent date for unique part
body: <p>How would I modify the following query to return Quote.Quote for only the most recent Quote_Date for each unique Part_Number? Since Quote is unique I am unable to return only the first record. I know this has been asked many times in almost the same fashion, however, I cant quite get it right using row_number, rank, partition, derived table, etc...  I am stuck.  Thanks for any help.</p>
  
  <pre><code>    Sample
      Quote     Part_Number     Quote_Date
      1              a              1/1/12
      2              a              1/2/12
      3              a              1/3/12
      4              b              1/2/12
      5              b              1/3/12
      6              c              1/1/12
  
      Desired Results
      Quote     Part_Number     Quote_Date
      3              a              1/3/12
      5              b              1/3/12
      6              c              1/1/12
  
      SELECT Quote.Quote, Quote.Part_Number, MAX(RFQ.Quote_Date) AS Most_Recent_Date
      FROM Quote INNER JOIN RFQ ON Quote.RFQ = RFQ.RFQ
      GROUP BY Quote.Part_Number, Quote.Quote
      HAVING (NOT (Quote.Part_Number IS NULL))
  </code></pre>