SELECT * FROM `sdb_b2c_orders` WHERE (pay_status='1' AND ship_status='0') OR (pay_status='0' AND payment='-1' AND ship_status='0') Yii2的model 如果写出这样的过滤规则呢??orWhere() andWhere()方法也无法在OR () 括号里面 像上面嵌套and
2 回答
慕森王
TA贡献1777条经验 获得超3个赞
$orders = Orders::find()->filterWhere([
'pay_status' => 1,
'ship_status' => 0
])->orFilterWhere([
'pay_status' => 0,
'payment' => 1,
'ship_status' => 0
])->all();
人到中年有点甜
TA贡献1895条经验 获得超7个赞
$orders = Orders::find()->where([
'AND',
['pay_status' => 1],
['ship_status' => 0]
])->orWhere([
'AND',
['pay_status' => 0],
['payment' => 1],
['ship_status' => 0]
])->all();
- 2 回答
- 0 关注
- 1695 浏览
添加回答
举报
0/150
提交
取消