title: SQL group by select
body: <p>I am using SQL Server and I have a table with the following columns:</p>
  
  <pre><code>SessionId | Date | first name | last name 
  </code></pre>
  
  <p>I would like to do <code>group by sessionId</code> and then get the row with the max date.</p>
  
  <p>For example:</p>
  
  <pre><code>xxx | 21/12/2012 | f1 | l1
  xxx | 20/12/2012 | f2 | l2
  yyy | 21/12/2012 | f3 | l3
  yyy | 20/12/2012 | f4 | l4
  </code></pre>
  
  <p>I would like to get the following rows:</p>
  
  <pre><code>xxx | 21/12/2012 | f1 | l1
  yyy | 21/12/2012 | f3 | l3
  </code></pre>
  
  <p>Thank you</p>