code igniter, custom selecting data using active record
I want to ask if I need to do this query in my app
select qty, type from tItem where qty=0 and (type=1 or price=100)
How do I do that using active record in code igniter?
because if i do
$this->db->where('qty','0');
$this->db->where('type','1');
$this->db->or_where('price','100');
the query would be like
sele开发者_C百科ct qty, type from tItem where qty=0 and type=1 or price=100
and it's not what i meant to
You can pass a custom clause, like this:
$this->db->where('(type = 1 OR price = 100)');
精彩评论