Mysql case on codeigniter active records - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Mysql case on codeigniter active records (/showthread.php?tid=46834) |
Mysql case on codeigniter active records - El Forum - 11-16-2011 [eluser]Djaka PM[/eluser] Hi, I used query on active records, that uses mysql case, but it seems the query never work because active records add a quote in the "case" keyword, here are the code: Code: $this->db->select('orl.id,case when ord.name is null then orc.name else ord.name end as name'); the output is: Code: Error Number: 1064 I have tried to run the questioned query on phpMyAdmin, it will only runs if I removed the qoute/backtick on the "case" keyword. is this a correct behaviour of active records? Because when I created a sql string and execute it using: Code: $sql = "select orl.id,case when ord.name is null then orc.name else ord.name end as name "; It work fine. Thank You... |