2010-01-04 51 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)');