Error in SQL QUERY

1
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

    
asked by anonymous 27.06.2018 / 10:49

1 answer

4

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
    
27.06.2018 / 12:52