SELECT COUNT(*) AS total
FROM table
GROUP BY (YEAR_MONTH FROM data)
ORDER BY (YEAR_MONTH FROM data) ASC
You are giving _YEAR_MONTH_ error and I do not know why
By the syntax, I believe you are using mysql
. So I think you've forgotten extract
.
SELECT COUNT(*) AS total
FROM table
GROUP BY EXTRACT(YEAR_MONTH FROM data)
ORDER BY EXTRACT(YEAR_MONTH FROM data) ASC