select count (*) from aaa group by bbb
出来的是总数,而不是组的数。
请帮忙
2 个解决方案
#1
记录的总数,就是 group 结果的
select DISTINCT bbb from aaa
select DISTINCT bbb from aaa
#2
select count(1) from (select bbb from aaa group by bbb) aa
#1
记录的总数,就是 group 结果的
select DISTINCT bbb from aaa
select DISTINCT bbb from aaa
#2
select count(1) from (select bbb from aaa group by bbb) aa