how to group by sting date according to year in php code example Example: mysql group by day GROUP BY DATE_FORMAT(record_date, '%Y%m')