我想进行多个 where 查询,同时使用 <
和 =
运营商。
有多个=
运营商它是这样的:
Model::find()->where([
'param1' => 0,
'param2' => 0,
])->all();
有一个<
运算符
Model::find()->where([
'<', 'param1', 0
])->all();
如何在一个中应用这两个条件 where
数组?
最佳答案
你可以结合使用 where 和 Where
Model::find()->where([param1' => 0 ])
->andWhere(['>','param2' , 0])->all();
将运算符添加到 you 子句中参见运算符格式
http://www.yiiframework.com/doc-2.0/guide-db-query-builder.html
关于php - yii2 ActiveRecord 多个 where,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40786298/