yii2判断数据库字段不为空

王林
王林原创
2020-02-18 11:33:163626浏览

yii2判断数据库字段is null,如下:

相关教程推荐:yii框架

示例:

$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);

更多编程相关内容,请关注php中文网编程入门栏目!

以上就是yii2判断数据库字段不为空的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。