WHERE `column` = `column` - 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: WHERE `column` = `column` (/showthread.php?tid=30190) |
WHERE `column` = `column` - El Forum - 05-05-2010 [eluser]skunkbad[/eluser] I'm using active record, and need to query WHERE `column_a` = `column_b` but $this->db->where() doesn't work. Do I have to create a custom query? WHERE `column` = `column` - El Forum - 05-05-2010 [eluser]Jamie Rumbelow[/eluser] You can pass a single string to $this->db->where() and it'll work fine. So: Code: $this->db->where('column_a = column_b'); Jamie WHERE `column` = `column` - El Forum - 05-05-2010 [eluser]skunkbad[/eluser] [quote author="Jamie Rumbelow" date="1273114538"]You can pass a single string to $this->db->where() and it'll work fine. So: Code: $this->db->where('column_a = column_b'); Jamie[/quote] Well, I had to use backticks to make it work. Thanks Code: $where = 'product_id = `product_group`'; |