最新消息: 新版网站上线了!!!

yii2判断数据库字段is null

  1. $query = new Query;              
  2. $query->select('ID, City,State,StudentName'
  3.       ->from('student')                                
  4.       ->where(['IsActive' => 1]) 
  5.       ->andWhere(['not', ['City' => null]]) 
  6.       ->andWhere(['not', ['State' => null]]) 
  7.       ->orderBy(['rand()' => SORT_DESC]) 
  8.       ->limit(10); 

 

转载请注明:谷谷点程序 » yii2判断数据库字段is null