title: Rails 4 where,order,group,count include zero's - postgresql
body: <p>Here is my query:  </p>
  
  <pre><code>User.where("created_at &gt;= ? AND created_at &lt;=?", date1,date2).order('DATE(created_at) DESC').group("DATE(created_at)").count  
  </code></pre>
  
  <p>and I get output as:  </p>
  
  <pre><code>{Thu, 15 May 2014=&gt;1}  
  </code></pre>
  
  <p>But I want to get output as 0 for the rest of the days. For ex  </p>
  
  <pre><code>{Thu, 15 May 2014=&gt;1,Fri, 15 May 2014=&gt;0}  
  </code></pre>
  
  <p>What I want to get is <code>Users</code> created in a <code>date range</code>, <code>ordered</code> and <code>grouped</code> by <code>created_at</code> and number of such <code>Users</code> for each day. When no users are there for a particular day it should return 0, which the current query doesn't return. </p>