[eluser]Thorpe Obazee[/eluser]
[quote author="simshaun" date="1245894363"]I had a situation come up the other day where I needed to group a couple where statements together. Typically I use Active Record for all my database stuff, but I ended up hardcoding that specific SQL statement.
Is there a way to group where statements together with Active Record where the SQL generated is something along the lines of
Code:
SELECT
id
FROM
users
WHERE
(first_name = 'John' AND age = 30)
OR
(first_name = 'John' AND height = 'tall')
OR
first_name = 'Bob'
[/quote]
Code:
$this->db->select('id')
$this->db->where("(first_name = John AND age = 30) OR (first_name = 'John' AND height = 'tall') OR first_name = 'Bob'")
$this->db->get('users')