title: Retrieve MySQL records where date is X day ago
body: <p>Hello i am trying to pull some record from MySQL DB, i've tried may solution here such as:</p>
  
  <pre><code>SELECT o.id_order, o.reference, o.id_customer, DATE_FORMAT(o.invoice_date, '%m%d%y') AS 'invoice_date'
  FROM ps_orders AS o
  WHERE DATE(o.invoice_date) = CURDATE() - INTERVAL 100 DAY;
  </code></pre>
  
  <p><strong>OR</strong></p>
  
  <pre><code>SELECT o.id_order, o.reference, o.id_customer, o.invoice_date
  FROM ps_orders AS o
  WHERE o.invoice_date = DATE_SUB(CURDATE(), INTERVAL 30 DAY);
  </code></pre>
  
  <p>But i keep getting 0 result.</p>
  
  <p>The format of:</p>
  
  <pre><code>o.invoice_date
  </code></pre>
  
  <p>is 2013-04-06 02:02:12 (YYYY-MM-DD HH:II:SS).</p>
  
  <p>I am not sure why i keep getting 0 result. When i try with this query:</p>
  
  <pre><code>SELECT o.id_order, o.reference, o.id_customer, o.invoice_date
  FROM ps_orders AS o
  WHERE o.invoice_date &lt; CURDATE() - INTERVAL 30 DAY
  ORDER BY o.invoice_date DESC;
  </code></pre>
  
  <p>it <strong>works</strong>, but i only want to get the data from <strong>x DAY ago (EXACTLY)</strong>. Can someone point me to the right direction. Thanks for the help...</p>