title: Getting Total Daily Sale for 7 days
body: <p>I am trying to get the date and SUM(total) for last 7 days. I am trying this code and getting <strong>date NULL and daily_sale 0.00</strong></p>
  
  <pre><code>SELECT
    date,
    IFNULL( SUM( total ), 0 ) AS daily_sale
  FROM sales
  WHERE date BETWEEN NOW()
      AND DATE_SUB(NOW(), INTERVAL 7 DAY)
  </code></pre>
  
  <p>I am note sure how to get the date and daily total sale. I want get results as</p>
  
  <pre><code>date       daily_sale    
  2013-01-29 500.00
  2013-01-28 500.00
  2013-01-27 500.00
  2013-01-26 500.00
  ...
  2013-01-23 500.00
  </code></pre>