title: Select distinct rows whilst grouping by max value
body: <p>I currently have the following table:</p>
  
  <pre><code>ID   |  Name    |  EventTime            |  State
  1001 |  User 1  |  2013/07/22 00:00:05  |  15
  1002 |  User 2  |  2013/07/23 00:10:00  |  100
  1003 |  User 3  |  2013/07/23 06:15:31  |  35
  1001 |  User 1  |  2013/07/23 07:13:00  |  21
  1001 |  User 1  |  2013/07/23 08:15:00  |  25
  1003 |  User 3  |  2013/07/23 10:00:00  |  22
  1002 |  User 2  |  2013/07/23 09:18:21  |  50
  </code></pre>
  
  <p>What I need is the <code>state</code> for each distinct <code>userid</code> from the last <code>eventtime</code> similar to below:</p>
  
  <pre><code>ID   |  Name    |  EventTime            |  State
  1001 |  User 1  |  2013/07/23 08:15:00  |  25
  1003 |  User 3  |  2013/07/23 10:00:00  |  22
  1002 |  User 2  |  2013/07/23 09:18:21  |  50
  </code></pre>
  
  <p>I need something similar to the following but I can't quite get what I need.</p>
  
  <pre><code>SELECT ID, Name, max(EventTime), State
  FROM MyTable
  GROUP BY ID
  </code></pre>