我是Codeigniter的新手,使用IF 语句时 mysql 出现错误,这是我的代码
$this->db->select('A.city_id, A.`name` AS city_name, B.`name` AS state_name, C.`name` AS country_name, IF(`A.visible`,"Yes","No") AS active');
$this->db->from('abs_city AS A');
$this->db->join('abs_state AS B', 'A.state_id = B.state_id AND B.visible = 1 AND A.country_id = B.country_id ', 'inner');
$this->db->join('abs_countries AS C', 'A.country_id = C.country_id AND B.visible = 1 ', 'inner' );
#$this->db->where('A.visible = 1');
return $this->db->get()->result();
浏览器中的错误
在 phpmyadmin 中运行查询后删除标记(`)
SELECT
`A`.`city_id`,
`A`.`name` AS city_name,
`B`.`name` AS state_name,
`C`.`name` AS country_name,
IF (A.visible, "Yes", "No") AS active
FROM
(`vbs_abs_city` AS A)
INNER JOIN `vbs_abs_state` AS B ON `A`.`state_id` = `B`.`state_id`
AND B.visible = 1
AND A.country_id = B.country_id
INNER JOIN `vbs_abs_countries` AS C ON `A`.`country_id` = `C`.`country_id`
AND B.visible = 1
请帮我解决这个问题,在此先感谢。
慕姐4208626
ABOUTYOU
子衿沉夜