codeigniter CI4分页,选择为

xtfmy6hx  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(166)

试着靠近,但ci4不工作分页与选择为(...)

$builder = $this->builder();
                
                $builder->join('branches','services_providers.sid = branches.serviceProvider');
                $builder->join('branches_categories','branches.sid = branches_categories.branch');
                
                $builder->select('services_providers.*, ((ACOS(SIN('.$latitude.' * PI() / 180) * SIN(branches.latitude * PI() / 180) + COS('.$latitude.' * PI() / 180) * COS(branches.latitude * PI() / 180) * COS(('.$longitude.' - branches.longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515 * 1.609344) as distance');
    $builder->having('distance > 50');
$builder->paginate(20);

哥德本错误:'having子句中的列'distance'未知
如果我使用findAll()而不是paginate,它工作正常

d6kp6zgx

d6kp6zgx1#

尝试将表名放在前面,如-〉“services_providers.distance”

$builder->having('services_providers.distance > 50');

相关问题