CodeIgniter Forums
Parentheses in active record queries - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Parentheses in active record queries (/showthread.php?tid=43146)



Parentheses in active record queries - El Forum - 07-01-2011

[eluser]cyberjunkie[/eluser]
Is is possible to add parentheses in queries produced by active records?

e.g.

Code:
SELECT * FROM (`posts`) WHERE `category` = 'health' AND (`tags` LIKE '%fruits%' OR 'tags' LIKE '%apples%`)

I read documentation and there's no example.

note: this is for a dynamic query. I'm adding an array in the or_like() function.


Parentheses in active record queries - El Forum - 07-01-2011

[eluser]WanWizard[/eluser]
No, this is not supported by default, but I recall someone mention a solution when it was discussed before.

Use the search to see if you can find it...