16

我正在codeigniterFIND_IN_SET()函数编写查询。

   $this->db->where(FIND_IN_SET('".$value."',employer_job_location));
    $query_res= $this->db->get("employer_posted_jobs");
   echo $this->db->last_query(); exit;

它正在产生

SELECT * 
FROM (`employer_posted_jobs`) 
WHERE (FIND_IN_SET('Delhi',employer_job_location)) IS NULL

在上面的查询中,“IS NULL”是额外的,很烦人。谁能说出为什么会出现这个查询?谢谢..

4

2 回答 2

18

您必须始终检查 FIND_IN_SET() 函数的结果以使其工作,试试这个:

$this->db->where("FIND_IN_SET('$value',employer_job_location) !=", 0);
于 2013-07-07T21:40:39.930 回答
0

$this->db->where("FIND_IN_SET('$value',employer_job_location) !=", 0);

于 2017-09-26T05:01:52.563 回答