title: SQL Server - Select Rows, Remove Duplicates But Keep row with highest date
body: <p>Considering the following database table in SQL Server 2008:</p>
  
  <pre><code>ActionID (PK)    ActionType    ActionDate              UserID  ContentID
  1                'Create'      '2013-05-26 18:40:00'   1       10
  2                'Create'      '2013-05-26 18:30:00'   2       10
  3                'Edit'        '2013-05-26 12:30:00'   5       12
  4                'Edit'        '2013-05-26 12:25:00'   5       12
  5                'Delete'      '2013-05-26 12:22:00'   6       12
  </code></pre>
  
  <p>I want to write a SQL query that groups by <code>ContentID</code> and <code>ActionType</code> but where the row with the latest <code>ActionDate</code> is returned and other rows ignored, even if they have different <code>UserID</code> or other column values.</p>
  
  <p>So what it should return is:</p>
  
  <pre><code>ActionID (PK)    ActionType    ActionDate              UserID  ContentID
  1                'Create'      '2013-05-26 18:40:00'   1       10
  3                'Edit'        '2013-05-26 12:30:00'   5       12
  5                'Delete'      '2013-05-26 12:22:00'   6       12
  </code></pre>
  
  <p>But I can't quite figure out how to write the query to do it.</p>