Reputation: 163
This is my query for the current day:
SELECT COUNT(*) FROM blog_posts WHERE postStatus = "pending" AND DATE(date_accepted) = CURDATE()
now how about if I want to query for this week? Thanks in advance..
Upvotes: 7
Views: 9010
Reputation: 780724
Use the YEARWEEK()
function
WHERE YEARWEEK(date_accepted) = YEARWEEK(NOW())
Don't just use WEEK()
because that will match weeks from different years.
Upvotes: 14