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