I want to retrieve data of last 1 week from emp_info table on per day basis.
So I have used :
SELECT DAYNAME(timestamp), COUNT(*) FROM `emp_info` WHERE DATE(timestamp ) > DATE_SUB(CURDATE( ) , INTERVAL 1 WEEK ) GROUP BY DAYNAME(timestamp); According to the query I am getting result like:
Monday 5 Thursday 7 But I also want the result of weekday as 0 on which no record has been entered.
From suggestions I come to know about JOIN query. So I have tried to fix it but not getting any solution.