MySQL - maximum of sum over different months
You need to GROUP BY nature_of_goods, if the counts should be separated by their values. To only show results of a particular month you have to put that in the WHERE, otherwise all months will be used.

Try something like this:

select max(mycount)
from   (select   count(nature_of_goods) AS mycount
        from     commodities
        where    month(created_at) = &lt;insert desired month here&gt;
        group by nature_of_goods) x;


.