title: mysql Select from where sum of columns is less than
body: <p>I'm trying to select from a database table like the folowing...</p>
  
  <pre><code>id   | task         | last_run    | interval
   1   |  test-run    |  1369715091 |  30
   2   |  anothertask |  1369715091 |  60
  </code></pre>
  
  <p><code>last_run</code> is unix-time, updated by the script, when it runs.
  Interval is the time between runs when this task needs to be executed.</p>
  
  <p>What I need to do is run a query where I select only the tasks where <code>last_run</code>+<code>interval</code> is less than the current time.</p>
  
  <p>This is what I've come up with...</p>
  
  <pre><code>SELECT *, (`last_run`+`interval`) as next_run FROM `tasks` WHERE (`next_run` &gt; '1369717906')
  </code></pre>
  
  <p>...however I get the error...</p>
  
  <pre><code>Unknown column 'next_run' in 'where clause'
  </code></pre>
  
  <p>Do you have any ideas?</p>