diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index 9f13287..338dbe1 100755 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -144,11 +144,11 @@ class Index extends Base public function get_user_yaoqing() { - //select * from ( SELECT pid,count(1) n FROM xinglanmh_shequt_test.`user` where pid>0 group by pid ) t where n>1 order by n desc LIMIT 10 + //select * from ( SELECT pid,count(1) n FROM `user` where pid>0 group by pid ) t where n>1 order by n desc $list = User::where('pid', '>', 0) ->field('pid, COUNT(1) as n') // 选取 pid 和 计数字段 ->group('pid') - ->having('n', '>',30) // `having` 需要使用 `as` 取别名 + ->having('n > 30') // `having` 需要使用 `as` 取别名 ->order('n desc') // ->limit(10) // 添加限制条数 ->select();