4

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())
kesm0
  • 847
  • 1
  • 11
  • 20

1 Answers1

5
SELECT YEARWEEK(date_inscription) as yweek,
       COUNT(*) as cnt
FROM PERSON
where YEARWEEK(date_inscription) >= YEARWEEK(curdate()) - 12
group by yweek
juergen d
  • 201,996
  • 37
  • 293
  • 362