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.
COUNT
This is what I have
First create a Calendar Table
SELECT coalesce(COUNT(O.*),0) as Norders, DATE_FORMAT(C.date, "%M %e") as sdate FROM Calendar C LEFT JOIN ORDERS O ON C.date=O.date WHERE O.date <= NOW() AND O.date >= NOW() - INTERVAL 1 MONTH GROUP BY DAY(date) ORDER BY date ASC;