Grouping where conditions using CI and AR - 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: Grouping where conditions using CI and AR (/showthread.php?tid=47255) |
Grouping where conditions using CI and AR - El Forum - 12-01-2011 [eluser]dandys997[/eluser] Hi, I need to group some clauses using ActiveRecord. For example, I would like to translate this query to ActiveRecord: Code: SELECT * FROM test WHERE (key="1" AND key="2" AND key="3") OR (key="4" AND key="5" AND key="6") Note that there will me more keys inside each group, so I would like to use an associative array to construct them. It should be something like: Code: $this->db->where(array("key" => "1", "key" => "2", "key" => "3")); But it doesn't work this way, of course. How can I reach my aim using AR? Thanks in advance for help! |