2010-01-04 48 views
2

我想问如果我需要在我的应用程序要做到这一点查询定制选择数据代码点火器,使用活动记录

select qty, type from tItem where qty=0 and (type=1 or price=100) 

我该怎么做,在代码点火器使用的活动记录?

,因为如果我这样做

$this->db->where('qty','0'); 
$this->db->where('type','1'); 
$this->db->or_where('price','100'); 

查询会像

select qty, type from tItem where qty=0 and type=1 or price=100 

,这不是我的意思,以

回答

3

您可以通过自定义的条款,像这样:

$this->db->where('(type = 1 OR price = 100)');