[ThinkPHP5]分页与having同时使用时报错的解决方法

发布时间:2023-01-14 17:30

        $buildSql = db('project')
                    ->alias('a')
                    ->join('user_project b','b.pid = a.id and b.uid = 1','LEFT')
                    ->field('a.id,a.title,b.id as uid')
                    ->order('a.id desc')
                    ->group('a.id')
                    ->having('uid is null')
                    ->buildSql();

        $page = input('page')??1;
        $pageSize = input('limit')??10;

        $list = Db::table($buildSql)
                ->alias('a')
                ->order('a.id desc')
                ->paginate(array('list_rows'=>$pageSize,'page'=>$page))
                ->toArray();

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号