ChartJS + mysql + php (subscriptions in the month)

0

Well, I have a table of user registrations.

I'm creating a chartjs to display the number of registered users per month on a bar chart.

The mysql query would only have to return me 2 columns (MONTH and TOTAL NUMBER OF SIGNATURES OF THAT MONTH)

I've tried it in several ways, but it returns me many columns: /

Thank you !!

    
asked by anonymous 16.05.2018 / 20:56

2 answers

0

month (month column) id (user id) users (table)

select mes, count(id) from usuarios group by mes
    
16.05.2018 / 21:02
0

I did it!

select month(primeira_conversao) as mes, year(primeira_conversao) as ano, count(id) as total from leads WHERE month(primeira_conversao) = 11 and year(primeira_conversao) = 2017 group by month(primeira_conversao),year(primeira_conversao)
    
16.05.2018 / 21:32