mysql语句求按字段分组后组数是多少

select count(distinct ID) from table

Thinkphp CURD写 $count = $model->where($where)->count('distinct 字段名');

原文地址:https://www.cnblogs.com/caicaizi/p/5581018.html