title: MySQL - Calculate the net time difference between two date-times while excluding breaks?
body: <p>In a MySQL query I am using the <strong>timediff/time_to_sec</strong> functions to calculate the total minutes between two date-times.</p>
  
  <p><strong>For example:</strong></p>
  
  <pre><code>2010-03-23 10:00:00
  -
  2010-03-23 08:00:00
  = 120 minutes
  </code></pre>
  
  <p>What I would like to do is exclude any breaks that occur during the selected time range.</p>
  
  <p><strong>For example:</strong></p>
  
  <pre><code>2010-03-23 10:00:00
  -
  2010-03-23 08:00:00
  -
  (break 08:55:00 to 09:10:00)
  = 105 minutes
  </code></pre>
  
  <p>Is there a good method to do this without resorting to a long list of nested IF statements?</p>
  
  <p><strong>UPDATE1:</strong></p>
  
  <p>To clarify - I am trying to calculate how long a user takes to accomplish a given task.  If they take a coffee break that time period needs to be excluded.  The coffee breaks are a at fixed times.</p>