EllisLab/CodeIgniter — Issue #756: Bug in query generation consisting of  MYSQL-String function
Author: mahadeb
Created: 2011-12-09 10:43:48+00:00
State: open

$this->db->select("CONCAT_WS( '-', C.phone, C.phone_ext) as phone, C.fax");
$this->db->from("tbl1 as O");
$this->db->join("tbl2 as C", "O.customer_id=C.id", "left");
$this->db->where_in("O.id", array(1,3) );
$list = $this->db->get()->result();

--------------
generate query:
SELECT CONCAT_WS( '-', `C`.`phone`, `C`.`phone_ext)` as phone FROM (`tbl1` as O) LEFT JOIN `tbl2` as C ON `O`.`customer_id`=`C`.`id` WHERE `O`.`id` IN ('1', '3')

Noe: extra backtick (`) after phone_ext) and for which SQL generate syntax error on query.