title: Mysql if not exists return 0
body: <p>I have a mysql table like this :</p>
  
  <pre><code>date           data
  01-01-2005       10 |
  02-01-2005       11|
  03-01-2005       13|
  07-01-2005       20|
  </code></pre>
  
  <p>How i can list like below</p>
  
  <pre><code>date           data:
  01-01-2005       10|
  02-01-2005       11|
  03-01-2005       13|
  04-01-2005       0|
  05-01-2005       0|
  06-01-2005       0|
  07-01-2005       20|
  </code></pre>
  
  <p>EDIT: i use a calendar table like this:</p>
  
  <pre><code>date:
  01-01-2005 for all 365 days.
  </code></pre>
  
  <p>this my best opinion but it is not working :</p>
  
  <pre><code>SELECT c.steps, IFNULL(c.steps, 0) value, r.calendar_date
    FROM log_activities c
    LEFT JOIN calendar r
      ON (r.calendar_date = c.date_logged)
   WHERE email = 'a@mail.com'
   ORDER BY c.date_logged DESC
  </code></pre>