If I have a table and data like this:
ID | Name | Group 1 Apple A 2 Boy A 3 Cat B 4 Dog C 5 Elep C
Try :
SELECT count(*),group FROM table GROUP BY group ORDER BY group
to order by count descending do
SELECT count(*),group FROM table GROUP BY group ORDER BY count(*) DESC
This will group the results by the group column returning the group and the count and will return the order in group order
group
count