title: Quick help using RANK over multiple variables
body: <p>I need a little help writing a SELECT statement for the following in SQL Server 2008: (example table)</p>
  
  <pre><code>  Date                       ProductID                       Year                       Price   
    01-01-10                   01                              2009                       1.00   
    02-01-10                   01                              2009                       2.00   
    03-01-10                   01                              2010                       3.00   
    04-01-10                   01                              2010                       4.00   
    05-01-10                   01                              2011                       5.00   
    06-01-10                   01                              2011                       6.00   
    01-01-10                   02                              2009                       1.00   
    02-01-10                   02                              2009                       2.00   
    03-01-10                   02                              2010                       3.00   
    04-01-10                   02                              2010                       4.00   
    05-01-10                   02                              2011                       5.00   
    06-01-10                   02                              2011                       6.00   
    01-01-10                   03                              2009                       1.00   
    02-01-10                   03                              2009                       2.00   
    03-01-10                   03                              2010                       3.00   
    04-01-10                   03                              2010                       4.00   
    05-01-10                   03                              2011                       5.00   
    06-01-10                   03                              2011                       6.00   
    01-01-10                   04                              2009                       1.00   
    02-01-10                   04                              2009                       2.00   
    03-01-10                   04                              2010                       3.00   
    04-01-10                   04                              2010                       4.00   
    05-01-10                   04                              2011                       5.00   
    06-01-10                   04                              2011                       6.00   
  </code></pre>
  
  <p>For each unique, ProductID-Year combination (e.g. 01-2009, 03-2011), I need to grab the line with the latest date. The actual data isn't so well-organized--there might only be 1 record for 01-2009, and 15 records for 03-2009.</p>
  
  <p>I think I have to use <code>DENSE RANK</code> but I'm not sure.</p>