以下MYSQL Query IN CI的正确语法是什么?

时间:2017-08-13 22:55:10

标签: php mysql codeigniter mysqli

我的版本是:

    $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 这是错误的语法,没有逗号这个查询工作正常

Result of MYSQL Query

0 个答案:

没有答案