我在用这个查询没有条件:Yii2 NOT IN不工作
$usertypes=Usertype::find()->where(['not in ','user_type_id',['2,3,4']])->all();
错误:
Database Exception – yii\db\Exception
未定义抵消:1 无法准备SQL:SELECT * FROM usertype
WHERE user_type_id
NOT IN:qp0
也尝试过阵列格式为['2','3','4']但不起作用?问题是什么?
删除sp ace'from'where(['in',' –
它看起来像你已经找到了解决方案,但值得注意的是,你可以否定这样的条件:' - > where(['not',['user_type_id' => ['2','3','4']]])'。 – spencer4of6