Below is the query i have written to fetch the order count with status=1 for last week.
SELECT count(*) as order_count,
DATE_FORMAT(order_date,'%d-%b-%Y') as order_date,
status
FROM customer_order
WHERE date(order_date) >= curdate()
- INTERVAL DAYOFWEEK(curdate())+6 DAY
AND date(order_date) < curdate()
- INTERVAL DAYOFWEEK(curdate())-1 DAY
AND status=1
GROUP BY DATE_FORMAT(order_date, '%Y%m%d'),
status
I am getting result only for the dates present in the table. I need all the dates with count = 0 if data is not present for particular date.