mysql group by year and month code example
Example 1: mysql group by day
GROUP BY DATE_FORMAT(record_date, '%Y%m')
Example 2: mysql group by date
SELECT SUM(foo), DATE(mydate) FROM a_table GROUP BY DATE(a_table.mydate);
GROUP BY DATE_FORMAT(record_date, '%Y%m')
SELECT SUM(foo), DATE(mydate) FROM a_table GROUP BY DATE(a_table.mydate);