我希望不要选择ID,我尝试过这段代码,但它没有用。
$this->coredb->select("u.id, username, email, firstname, lastname, email_signature");
$this->coredb->join("core_utypes cu", "cu.id = u.id", "left");
$this->coredb->where("(cu.utype = 3 OR u.utype = 3)");
$this->coredb->where("(cu.utype = 6 OR u.utype = 6)");
$this->coredb->where("status", 1);
$ids = ("89, 108, 49, 109, 38, 54, 87, 90, 104, 74, 99, 111, 87, 84, 94");
$this->coredb->where("u.id NOT IN", $ids);
$this->coredb->order_by("u.lastassigned", "asc");
$query = $this->coredb->get("core_users u");
return $query->row_array();
答案 0 :(得分:0)
如果您想使用WHERE IN
,则需要使用->where_in
或->where_not_in
。
$ids = array(89, 108, 49, 109, 38, 54, 87, 90, 104, 74, 99, 111, 87, 84, 94);
$this->coredb->where_not_in("u.id", $ids);
DOCS:http://ellislab.com/codeigniter/user-guide/database/active_record.html