이것은 쿼리에서 FIND_IN_SET을 사용하는 방법으로 자동으로 쿼리에서 IS NULL을 추가하고 이후에 대괄호를 추가해야합니다 WHERE s
. cat_id
= '11'AND 쿼리FIND_IN_SET 자동으로 codeigniter의 쿼리에 IS NULL을 추가하고 그룹을 만들기 위해 쿼리에 대괄호를 추가해야합니다.
$spilt=explode(',',$newstyle);
foreach ($spilt as $splitkey => $splitvalue) {
if ($splitkey == 0) {
$this->db->where("FIND_IN_SET(".$splitvalue.",w_card_style)");
}
else{
$this->db->or_where("FIND_IN_SET(".$splitvalue.",w_card_style)");
}
}
난 $this->db->last_query()
를 사용하여 쿼리를 인쇄이 후
SELECT `c`.`city_name`, `s`.`name`, `s`.`location`, `s`.`starting_price`, `s`.`budget_range`, `s`.`cat_id`, `s`.`id`, `i`.`path`, `s`.`specification_status`, `s`.`per_unit_charge`, `s`.`w_card_style`, `s`.`w_card_style`, `s`.`budget_range` FROM `image_gallery` as `i` JOIN `specification` as `s` ON `i`.`ser_id`=`s`.`id` JOIN `cities` as `c` ON `c`.`city_id`=`s`.`location` JOIN `wcard_style` as `ws` ON `ws`.`id`=`s`.`w_card_style` WHERE `s`.`cat_id` = '11' AND FIND_IN_SET(1,w_card_style) IS NULL OR FIND_IN_SET(2,w_card_style) IS NULL OR FIND_IN_SET(3,w_card_style) IS NULL AND budget_range BETWEEN 50 AND 100 GROUP BY `ser_id` HAVING `cat_id` = '11' ORDER BY `s`.`budget_range` DESC
추천 검색어를 제공 각각 존재 FIND_IN_SET는 NULL이므로 얼마나 제거하려면 쿼리에서 NULL IS 또한이
SELECT `c`.`city_name`, `s`.`name`, `s`.`location`, `s`.`starting_price`, `s`.`budget_range`, `s`.`cat_id`, `s`.`id`, `i`.`path`, `s`.`specification_status`, `s`.`per_unit_charge`, `s`.`w_card_style`, `s`.`w_card_style`, `s`.`budget_range` FROM `image_gallery` as `i` JOIN `specification` as `s` ON `i`.`ser_id`=`s`.`id` JOIN `cities` as `c` ON `c`.`city_id`=`s`.`location` JOIN `wcard_style` as `ws` ON `ws`.`id`=`s`.`w_card_style` WHERE `s`.`cat_id` = '11' AND (FIND_IN_SET(1,w_card_style) IS NULL OR FIND_IN_SET(2,w_card_style) IS NULL OR FIND_IN_SET(3,w_card_style) IS NULL) AND budget_range BETWEEN 50 AND 100 GROUP BY `ser_id` HAVING `cat_id` = '11' ORDER BY `s`.`budget_range` DESC`enter code here`
의 정확한 복제 ([CodeIgniter의은 첨가가 발견 \ 유념하라 \ _set의 null] https://stackoverflow.com/questions/33390038/codeigniter-adding-the-is-null-in-the- find-in-set) – mickmackusa