group by 查询分组后 组的条数

比如select gid from table group by gid

查询时使用下面的方法查询条数

select count(distinct gid) from table

使用select count(gid) from table group by gid是错误的

这样查询的是分组后 每个组内部的条数

原文地址:https://www.cnblogs.com/rchao/p/4562836.html