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())
Was it helpful?

Solution

SELECT YEARWEEK(date_inscription) as yweek,
       COUNT(*) as cnt
FROM PERSON
where YEARWEEK(date_inscription) >= YEARWEEK(curdate()) - 12
group by yweek
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top