Compare data from two different tables using codeigniter - 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: Compare data from two different tables using codeigniter (/showthread.php?tid=58204) |
Compare data from two different tables using codeigniter - El Forum - 05-23-2013 [eluser]Unknown[/eluser] I am new to codeigniter and I want to write this mySql query Code: SELECT COUNT(DISTINCT source) AS NumberOfEvaluations into codeigniter. This is my try Code: $this->db->select('t1.count(DISTINCT(source))'); Compare data from two different tables using codeigniter - El Forum - 05-23-2013 [eluser]Unknown[/eluser] Maybe this one ? Code: $this->db->select('count(DISTINCT(source))'); Compare data from two different tables using codeigniter - El Forum - 05-24-2013 [eluser]TheFuzzy0ne[/eluser] Welcome to the CodeIgniter forums! You didn't mention what the problem was. I assume you're having trouble with CodeIgniter escaping your SELECT clause? You can pass FALSE into $this->db->select() as the second parameter to prevent that. Code: $this->db->select('count(DISTINCT source)', FALSE); |