title: MySQL: Select All Dates In a Range Even If No Records Present
body: <p>I have a database of users. I would like to create a graph based on userbase growth. The query I have now is:</p>
  
  <pre><code>SELECT DATE(datecreated), count(*) AS number FROM users 
  WHERE DATE(datecreated) &gt; '2009-06-21' AND DATE(datecreated) &lt;= DATE(NOW())
  GROUP BY DATE(datecreated) ORDER BY datecreated ASC
  </code></pre>
  
  <p>This returns <em>almost</em> what I want. If we get 0 users one day, that day is not returned as a 0 value, it is just skipped and the next day that has at least one user is returned. How can I get something like (psuedo-response):</p>
  
  <pre><code>date1 5
  date2 8
  date3 0
  date4 0
  date5 9
  etc...
  </code></pre>
  
  <p>where the dates with zero show up in sequential order with the rest of the dates?</p>
  
  <p>Thanks!</p>