mysql select sum group by date

This solution will give you the month name as a column of your resultset, followed by the total as required.

SELECT MONTHNAME(o_date), SUM(total) 
FROM theTable
GROUP BY YEAR(o_date), MONTH(o_date)

Leave a Comment