Codeigniter 如何像编写代码点火器一样编写mysql查询

Codeigniter 如何像编写代码点火器一样编写mysql查询,codeigniter,Codeigniter,如何像codeigniter中的连接条件一样编写下面的查询 $query=$this->db->query("select TypeID,verification_type from table_verify where TypeID not in(select verificationId from table_invistigate where Id=$id)"); $result = $query->result(); return $

如何像codeigniter中的连接条件一样编写下面的查询

$query=$this->db->query("select TypeID,verification_type from table_verify where TypeID not in(select verificationId from table_invistigate where Id=$id)");
          $result = $query->result();
        return $result;

像这样。首先获取验证ID数组,然后在
$this->db->where\u not\u in()
中使用该数组


如果直接使用
$this->db->query()
,则不会阻止sql禁令。我尝试了$VerificationId=$this->db->get('table_invisigate')->result_array();它返回数组的数组,该数组将数据库错误显示为“codeigniter活动记录中的子查询”的(数组,数组)副本中的where not
$this->db->select('verificationId');
$this->db->where('Id',$id);
$verificationIds = $this->db->get('table_invistigate')->result_array(); //array of   verificationIds 

foreach($verificationIds as $vid){
$ids[] = $vid['verificationId']; 
}


$this->db->select('TypeID,verification_type');
$this->db->where_not_in('TypeID',$ids);
$result = $this->db->get('table_verify')->result_array();
print_r($result);
    $this->db->select('table_verify.*,table_invistigate.verificationId');
    $this->db->from('table_verify');
    $this->db->join('table_invistigate',
   'table_verify.verificationId=table_invistigate.verificationId ');
    $this->db->where('table_verify.id',$id);
    $query = $this->db->get();
    return $query->result();