修改问题

This commit is contained in:
baji 2025-03-09 14:46:17 +08:00
parent 20d475a7bf
commit 2f697dd7f4

View File

@ -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();