thinkphp 查询 根据重复字段的数量进行排序

$model=M('answer');
$model->field('count(username) num,username')->group('username')->order('num desc')->limit('3');
//也可以使用普通的sql语句,然后$model->query()

猜你喜欢

转载自blog.csdn.net/luoxiping1/article/details/80078741
今日推荐