Yii2查询语句使用不等于号

Yii2 Active Record查询条件使用不等于号,须要使用到html

operator format: [operator, operand1, operand2, ...]yii2

运算符格式: [运算符, 运算对象1, 运算对象2, ...]yii

演示代码:ide

$details = MovieShows::find()->where(['movie_id'=>$id])
           ->andWhere(['location_id'=>$loc_id])
           ->andWhere(['<>','cancel_date', $date])->all();

从演示的代码的最后一行代码,能够看到第一个元素是运算符号,第二个元素是数据表中的字段,第三个元素是值。spa

文章参考了:code

  1. How to use not equal to inside a Yii2 query
  2. Interface yii\db\QueryInterface
相关文章
相关标签/搜索