![]() |
Help with Complex MySQL Queries - 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: Help with Complex MySQL Queries (/showthread.php?tid=47882) |
Help with Complex MySQL Queries - El Forum - 12-26-2011 [eluser]Unknown[/eluser] Hello! I have been using CI for along time and I love most of it. I just ran into a hiccup though. Is there a way to write more complex (grouped/math-like) SQL expressions using active records? In other words, is it possible to translate the following using active records? Code: SELECT * FROM TableName WHERE id = 123 AND (approved = 1 OR created_by = current_user_id); *Note the brackets I ended up with queries that use LIKE as well and get much longer but the above is a simpler case. All I want to know is if it's possible to add brackets within expressions and how would you to that. Thanks in advance! |