In CodeIgniter 3 zijn er nieuwe methoden group_start() en group_end() die precies voor dit doel dienen.
return $this->db
->where('LastName', 'Svendson');
->where('Age', 12);
->group_start()
->where('FirstName','Tove')
->or_where('FirstName','Ola')
->or_where('Gender','M')
->or_where('Country','India')
->group_end()
->get('Persons')
->result();