select by year month from date in mysql code example
Example 1: mysql select month and year
SELECT DATE_FORMAT(test_date,'%Y%m') AS date FROM test_table;
Example 2: extract month from date in mysql
MONTH(date)
SELECT DATE_FORMAT(test_date,'%Y%m') AS date FROM test_table;
MONTH(date)