Welcome Guest, Not a member yet? Register   Sign In
Trying to add parentheses im Active Record Query
#1

[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


Messages In This Thread
Trying to add parentheses im Active Record Query - by El Forum - 05-13-2010, 05:31 PM
Trying to add parentheses im Active Record Query - by El Forum - 05-14-2010, 01:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB