Level 2
i already got the Ans from stack overflow here is the link u can checkout https://stackoverflow.com/questions/64674751/generate-a-last-7-days-weekly-report-in-mysql/64674797#64674797
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to get a report of my eco_orders table that how much order i get in a day for last 7days. i got the result with below sql and it's absolutely fine. but the problem is i want to include the non order day count with zero.
SELECT DAYNAME(created_at) AS DAY, count(*)
FROM `eco_orders`
WHERE created_at >= DATE(NOW()) - INTERVAL 7 DAY
GROUP BY DAY;
+-----------+----------+
| DAY | count(*) |
+-----------+----------+
| Thursday | 1 |
| Wednesday | 2 |
+-----------+----------+
expected output
+-----------+----------+
| DAY | count(*) |
+-----------+----------+
| Saturday | 0 |
| Sunday | 0 |
| Monday | 0 |
| Tuesday | 0 |
| Wednesday | 2 |
| Thursday | 1 |
| Friday | 0 |
+-----------+----------+
i already got the Ans from stack overflow here is the link u can checkout https://stackoverflow.com/questions/64674751/generate-a-last-7-days-weekly-report-in-mysql/64674797#64674797
Please or to participate in this conversation.