I have a table in my mysql db that has two columns: group and subgroup. See below.
group, subGroup grp-A, sub-A grp-A, sub-A grp-A, sub-B grp-B
You must group both columns, group and sub-group, then use the aggregate function COUNT().
COUNT()
SELECT group, subgroup, COUNT(*) FROM groups GROUP BY group, subgroup