我想询问是否需要在我的应用程序中执行此查询
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
这不是我的本意
最佳答案
您可以传递自定义子句,如下所示:
$this->db->where('(type = 1 OR price = 100)');
关于activerecord - codeigniter,使用事件记录自定义选择数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1999305/