2
MySQL COUNT today week month
SELECT
*,
COUNT(IF(date >= curdate(), 1, NULL)) 'todaycount',
COUNT(IF(yearweek(date) = yearweek(curdate()), 1, NULL)) 'weekcount',
COUNT(IF(month(date) = month(curdate()), 1, NULL)) 'monthcount',
COUNT(IF(date <= curdate(), 1, NULL)) 'allcount'
FROM
mytable
rated 2 times
(2)
(0)
comments: 1 / hits: 215
/ 4 months ago, wed, jan 6, 21, 02:42:50
More From
» SQL
Comments
1
How about:
Code:
[#56] Sunday, January 10, 2021, 4:03:20

commented 3 months ago
suppe
Only authorized users can post. Please sign in first, or register a free account