title: Dynamic minimum value for specfic range (mysql)
body: <p>I am looking for a solution to SELECT (or otherwise derive) the values for Column C (minimum price for last 3 days only, not for the whole column).</p>
  
  <pre><code>----------------------------------------
  Date          | Unit_ | Low_3_days     | 
                | price |                | 
  ----------------------------------------
  2015-01-01    | 15    | should be: 15  | 
  2015-01-02    | 17    | should be: 15  | 
  2015-01-03    | 21    | should be: 15  | 
  2015-01-04    | 18    | should be: 17  | 
  2015-01-05    | 12    | should be: 12  | 
  2015-01-06    | 14    | should be: 12  |
  2015-01-07    | 16    | should be: 12  | 
  ----------------------------------------
  </code></pre>
  
  <p>My thought revolves around the following, but yielding an error:</p>
  
  <pre><code>select S.Date,Unit_price, 
        (SELECT min(LOW_3_days) 
           FROM table 
          where S.DATE BETWEEN S.DATE-1 
                           and S.DATE-3) 
             AS min_price_3_days
    FROM table AS S
  </code></pre>
  
  <p>What is the correct query to get this to work? Database used MySQL.</p>