title: TSQL Select Max
body: <pre><code>Userid   FirstName   LastName        UserUpdate 
  1        Dan         Kramer          1/1/2005  
  1        Dan         Kramer          1/1/2007  
  1        Dan         Kramer          1/1/2009  
  2        Pamella     Slattery        1/1/2005  
  2        Pam         Slattery        1/1/2006  
  2        Pam         Slattery        1/1/2008  
  3        Samamantha  Cohen           1/1/2008  
  3        Sam         Cohen           1/1/2009  
  </code></pre>
  
  <p>I need to extract the latest updated for all these users, basically here's what I'm looking for:</p>
  
  <pre><code>Userid   FirstName   LastName        UserUpdate  
  1        Dan         Kramer          1/1/2009     
  2        Pam         Slattery        1/1/2008   
  3        Sam         Cohen           1/1/2009  
  </code></pre>
  
  <p>Now when I run the following:</p>
  
  <p>SELECT Userid, FirstName, LastName, Max(UserUpdate) AS MaxDate 
  FROM Table
  GROUP BY Userid, FirstName, LastName</p>
  
  <p>I still get duplicates, something like this:</p>
  
  <pre><code>Userid   FirstName   LastName        UserUpdate 
  1        Dan         Kramer          1/1/2009  
  2        Pamella     Slattery        1/1/2005  
  2        Pam         Slattery        1/1/2008  
  3        Samamantha  Cohen           1/1/2008  
  3        Sam         Cohen           1/1/2009 
  </code></pre>