SyntaxFix
Write A Post
Hire A Developer
Questions
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