title: mysql date_sub using a field as interval
body: <p>I need help with mysql and date_sub(). I have a table call Activity </p>
  
  <pre><code>Activity(id,deadline,alert)
  Activity(1,'2011-04-18','1 DAY');
  Activity(2,'2011-04-13','1 MONTH');
  </code></pre>
  
  <p>Every row in A have an 'alert', this field indicate how time before the deadline an activity have to reported. </p>
  
  <p>For example</p>
  
  <pre>
  On 2011-04-17 I have to report the activity with 'id' 1
  On 2011-03-14 I have to report the activity with 'id' 2
  </pre>
  
  <p>I trying to use <code>date_sub()</code> functions, but I can't use a field as params of this function. Any idea how to fix this?</p>
  
  <pre><code>SELECT * 
    FROM `activities` 
   WHERE date_sub(`deadline`, INTERVAL alert) &gt;= CURDATE();
  </code></pre>