you could also try as below

$rs = $this->db->or_where( array('created_by'=>3, 'assigned_to'=>3))->where(array('status'=>'open'))->get('tasks')->result();


On Thu, Apr 4, 2013 at 2:33 AM, Nd'wex Common <flexycat@gmail.com> wrote:
$rs = $this->db->where("status = 'Open' AND (created_by = 3 OR assigned_to = 3)")->get('tasks')->result();



On Thu, Apr 4, 2013 at 12:44 AM, Peter Karunyu <pkarunyu@gmail.com> wrote:
@Ian, so there is no way of using the constructs $this->db->where() or $this->db->or_where() in some magical way to achieve the above?


On Thu, Apr 4, 2013 at 3:30 PM, Ian Madege <imadege1990@gmail.com> wrote:
use 
$this->db->query(' your sql')

should allow  you to do anything


On Thu, Apr 4, 2013 at 2:06 AM, Peter Karunyu <pkarunyu@gmail.com> wrote:
Suppose I have a tasks table which contains tasks created by several people and where each task can be assigned to any other user,
with columns like these:

status - A string value, can be Open, In Progress or Closed
created_by - int value, stores the id of the user who created the task
assigned_to - int value, stores the id of the user assigned to a task

And I want to see only open tasks created by or assigned to me, i.e. the query:

SELECT * FROM tasks WHERE status = 'Open' AND (created_by = 3 OR assigned_to = 3)

How can I do this using CodeIgniter ActiveRecord?

--
Regards,
Peter Karunyu
-------------------

_______________________________________________
skunkworks mailing list
skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke



--
Ian  Vuyayi Madege
Software engineer
 As  a programmer  a computer  will always  do what you command  it to do.

_______________________________________________
skunkworks mailing list
skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke



--
Regards,
Peter Karunyu
-------------------

_______________________________________________
skunkworks mailing list
skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke