title: Query SQL distinct field with max date, returning all fields from table
body: <p>I'm having a hard time trying to get a query that sounds simple. I'm using SQL Server 2008.</p>
  
  <p>I have this table:</p>
  
  <pre><code>ID  Name  Date        Zone
  ----------------------------
  01  AAA   01/01/2010  North
  02  BBB   02/02/2010  South
  03  AAA   05/01/2010  West 
  </code></pre>
  
  <p>So, I need to filter the table to get distinct items (by Name), but, in case the item is repeated, get the one with the max date. Here is the result that I wanted to get from the example above:</p>
  
  <pre><code>ID  Name  Date        Zone
  ----------------------------
  02  BBB   02/02/2010  South
  03  AAA   05/01/2010  West 
  </code></pre>
  
  <p>The problem is that I need to get all the fields from the table (I mean: Id, Name, Date and Zone should be returned from the query) once applied the filter.</p>