SELECT YEARWEEK(date_inscription) as yweek,
COUNT(*) as cnt
FROM PERSON
where YEARWEEK(date_inscription) >= YEARWEEK(curdate()) - 12
group by yweek
Mysql need to COUNT inscription per week lasts 12 weeks
-
18-03-2022 - |
Question
I already count inscriptions, this week. But i need to count inscription per week last 12 weeks, and send it in an array.
My actual request is :
SELECT COUNT(*) FROM PERSON
YEAR(date_inscription) = YEAR(NOW())
AND WEEK(date_inscription) = WEEK(NOW())
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow