group by only year in the date code example Example: mysql group by day GROUP BY DATE_FORMAT(record_date, '%Y%m')