0👍
✅
Just use MySQL MONTH()
function, like:
SELECT MONTH(table.date) from table WHERE ...
In case you want to count the amount by month, so use the count function and group the query by MONTH(datetime)
. If you need help with this, please leave a comment.
For example, if you have a table that has a list of users, it will look something like that:
SELECT YEAR(register_date), MONTH(register_date) AS MONTH, COUNT(*) AS registered FROM users GROUP BY YEAR(register_date), MONTH(register_date)
– this will give you the result of registered users count by year and month.
Source:stackexchange.com