![]() |
Trying to add parentheses im Active Record Query - 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: Trying to add parentheses im Active Record Query (/showthread.php?tid=30413) |
Trying to add parentheses im Active Record Query - El Forum - 05-13-2010 [eluser]edelcal[/eluser] Hey guys. I was developing an SQL query and found out that i need parentheses for retrieving to correct data. The query would look like this (i didnt show the joins): SELECT * FROM (`media`) WHERE `galleries`.`galleryShow` = 'y' AND `galleries`.`galleryType` = 'video' AND (`games`.`gameName_en` LIKE '%book%' OR `games`.`gameName_es` LIKE '%book%' OR `game_platform`.`keywords` LIKE '%book%' ) ORDER BY `mediaDate` desc So i dont know how to enter a paretheses after the AND when i want to have some ORs between them, like in the example. With Active Records i can use: $this->db->or_like('games.gameName', '%book%' ); but i would like to be able to insert parentheses before and after all the OR querys. Hope some of you guys have any idea for doing this. Many thanks Trying to add parentheses im Active Record Query - El Forum - 05-14-2010 [eluser]Armchair Samurai[/eluser] Something like: Code: $search = $this->db->escape_like_str('book'); |