多选
select count(id) from table where name='a'
select count(id) from table where name='b'
单选组
select name,count(id) from table where name in('a','b') group by name;
哪个更好?
最佳答案
我说这样一个简单示例中的 group by 语句会执行相同或更好,并且可能更好,因为如果您运行两个需要分组的不同 select 语句,那么发布的性能将会受到影响也会处理您的信息。
关于mysql - 哪个更好 mysql group count 或 count,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13944725/