试着靠近,但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,它工作正常。
1条答案
按热度按时间d6kp6zgx1#
尝试将表名放在前面,如-〉“services_providers.distance”