关于TP对数据库某个字段分组统计
SQL语句
select count(*) as total, 字段1 from 表名1 where (条件1) and (条件2) ... group by 字段1 ORDER BY total ASC
N个条件查与不查都有可能
求大神指点怎么用ThinkPHP写
------解决思路----------------------
$mdel->field("count(*) as total")->where($condition)->group(字段1)->order(total ASC)
$condition为条件数组