当我将 = 加入时,它可以正常工作,但是当我把!= 提取错误的数据时。
$this->db->from('invoice_periodicity ip', 'ip.Periodicity_Ids != tpd.Id');
它给所有test_periodicity_details数据提供了我需要的结果。
示例:我需要从43 8 10 11中获取43和8 但它给出了结果。 43 43 8 8 10 11
$this->db->select('*', FAlSE);
$this->db->where('t.Flag', '0');
$this->db->where('tpd.Test_Id', $id);
$this->db->from('test_periodicity_details tpd');
$this->db->join('test t', 'tpd.Test_Id=t.Test_Id');
$this->db->join('school_information si', 't.School_Id=si.School_Id', 'left');
$this->db->join('test_status ss', 'tpd.Status=ss.Test_Status_Id', 'left');
$this->db->join('login_details ld', 'ld.Login_Details_Id=t.Test_Created_By', 'left');
$this->db->join('invoice_periodicity ip', 'ip.Periodicity_Ids != tpd.Id');
//echo $this->db->get_compiled_select();
$query = $this->db->get();
if ($query->num_rows() > 0){
return $query->result();
}
else {
return false;
}
当我回显Query-
SELECT * FROM `test_periodicity_details` `tpd` JOIN `test` `t` ON `tpd`.`Test_Id`=`t`.`Test_Id` LEFT JOIN `school_information` `si` ON `t`.`School_Id`=`si`.`School_Id` LEFT JOIN `test_status` `ss` ON `tpd`.`Status`=`ss`.`Test_Status_Id` LEFT JOIN `login_details` `ld` ON `ld`.`Login_Details_Id`=`t`.`Test_Created_By` JOIN `invoice_periodicity` `ip` ON `ip`.`Periodicity_Ids` != `tpd`.`Id` WHERE `t`.`Flag` = '0' AND `tpd`.`Test_Id` = '1'