Chartjs + mysql + php (month entries)

Asked

Viewed 124 times

0

Guys, I have a user registration table.

I am creating a chartjs to show on a bar chart the number of registered users per month.

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

I have tried several ways, but returns me many columns :/

Thank you!!

2 answers

0

month (column of months) id (id of users) users (table)

select mes, count(id) from usuarios group by mes
  • I used it as follows

  • select primeira_conversao, Count(id) as total leads WHERE Month(primeira_conversao) = 10 group by primeira_conversao

0

I got!

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)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.