知道如何将下面的查询转换为 Codeigniter 吗?
select agency from agency where agency not in (SELECT agency FROM trip where trip_type = 'local trip' group by trip_type, agency having count(agency)=(select count(*) from role));
尝试过但失败了。请帮忙
$this->db->select('agency');
$this->db->from('agency');
$this->db->where_not_in('agency', function($query) {
$query->select('agency')->from('trip')->where('trip_type', 'local trip')->group_by(['trip_type', 'agency'])->having('count(agency)', '(SELECT count(*) FROM role)', FALSE);
}, NULL, FALSE);
$query = $this->db->get();