What I want to do is use sum if in codeigniter, it's got error when I run in browser, but I query in MYSQL, there are not error and working nicely.
Here is my code
$this->db->select('sum(if(`monitoring_type` = 1,1,0)) AS independent,sum(if(`monitoring_type` = 2,1,0)) AS buddy,count(*) AS TM, rate_info.qm_title');
$this->db->from('qm.recordings');
$this->db->join('qm.rate_info', 'recordings.record_id = rate_info.record_id');
$query = $this->db->get();
return $query->result();
my Error

MYSQL
