Yii 2.0 使用andWhere实现and or查询
在Yii2.0框架中使用andWhere方法实现A = 1 or B = 1 数据库(MySQL)查询的具体方法
$yiilibTask = YiiLibTask::find()->where(['yl_user_id'=>null])->andWhere(['or' ,['yl_status_id'=>1], ['yl_status_id'=>2], ['yl_status_id'=>3]])->all();
SELECT * FROM `yiiLibTask` WHERE (`yl_user_id` IS NULL) AND ((`yl_status_id`=1) OR (`yl_status_id`=2) OR (`yl_status_id`=3))
留言