title: MySQL: How to SUM() a TIMEDIFF() on a group?
body: <p>So I've got a set of results that looks something like this:</p>
  
  <pre><code>SELECT User_ID, StartTime, EndTime, TIMEDIFF(EndTime, StartTime) AS TimeDiff
  FROM MyTable
  
  ------------------------------------------------------------------
  | User_ID |       StartTime     |         EndTime     | TimeDiff |
  ------------------------------------------------------------------
  |    1    | 2010-11-05 08:00:00 | 2010-11-05 09:00:00 | 01:00:00 |
  ------------------------------------------------------------------
  |    1    | 2010-11-05 09:00:00 | 2010-11-05 10:00:00 | 01:00:00 |
  ------------------------------------------------------------------
  |    2    | 2010-11-05 06:30:00 | 2010-11-05 07:00:00 | 00:30:00 |
  ------------------------------------------------------------------
  |    2    | 2010-11-05 07:00:00 | 2010-11-05 09:00:00 | 02:00:00 |
  ------------------------------------------------------------------
  |    2    | 2010-11-05 09:00:00 | 2010-11-05 10:00:00 | 01:00:00 |
  ------------------------------------------------------------------
  </code></pre>
  
  <p>Now I need to group the results by <code>User_ID</code> and <code>SUM()</code> TimeDiff. If I add a <code>GROUP BY</code> clause, it doesn't <code>SUM()</code> the TimeDiff (and I wouldn't expect it to). How can I <code>SUM()</code> the TimeDiffs for each User? </p>