Yii 2.0 use andWhere() Do and or query
In Yii 2.0 Framework, use andWhere() function run DB(MySQL) Query like A = 1 or B = 1
$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))
Leave Comment