Wednesday, January 30, 2019

yii2 search where not in condition usage

suppose we have two parameters to check

Like for example

where country_id = 4  AND city_id not in (2,3,4)

then using yii2 we can do the following

 Members::find()->select(['id','name'])->where(['country_id'=>4])->andWhere(['not in','id',[2,3,4]])->all();

No comments:

Post a Comment