i have year on columns and id on rows i want group by year code example Example: mysql group by day GROUP BY DATE_FORMAT(record_date, '%Y%m')