我的版本是:
$this->db->select('cam_id') ->where('cam_id NOT IN (SELECT cam_id FROM bus) AND cam_id %2 != 0') ->order_by("cam_id","asc") ->limit(1) ->get('camera') ->row_array();
但得到错误:CI将其转换为
SELECT `cam_id` FROM `camera` WHERE `cam_id` NOT IN (SELECT `cam_id` FROM `bus`) AND `cam_id` `%2` !=0 ORDER BY `cam_id` ASC LIMIT 1;
把逗号 围绕%2 这是错误的语法,没有逗号这个查询工作正常