Aggregating data by date in a date range without date gaps in result set
问题 I have a table with sell orders and I want to list the COUNT of sell orders per day, between two dates, without leaving date gaps. This is what I have currently: SELECT COUNT(*) as Norders, DATE_FORMAT(date, "%M %e") as sdate FROM ORDERS WHERE date <= NOW() AND date >= NOW() - INTERVAL 1 MONTH GROUP BY DAY(date) ORDER BY date ASC; The result I'm getting is as follows: 6 May 1 14 May 4 1 May 5 8 Jun 2 5 Jun 15 But what I'd like to get is: 6 May 1 0 May 2 0 May 3 14 May 4 1 May 5 0 May 6 0 May