yii2判断数据库字段is null

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

 

posted on 2016-03-03 10:46  yhdsir  阅读(3194)  评论(0编辑  收藏  举报

导航