我想计算count和group by table结果的结果
就像我有一张桌子一样a:
id |name
1 |abc
2 |abc
3 |abc
4 |xyz
5 |xyz
Run Code Online (Sandbox Code Playgroud)
我的疑问是 SELECT COUNT(id) as count_id from a GROUP BY name
...给出结果:
count_id
3
2
Run Code Online (Sandbox Code Playgroud)
我想要计算这个结果的总行数是2
所以我的查询是 SELECT COUNT(SELECT COUNT(id) as count_id from a GROUP BY name) as maincount from a
...但它给了我这个错误 phpmyadmin
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT count.....