How to do IS NULL and IS NOT NULL with Yii 2 ActiveRecord?

后端 未结 5 2028
情话喂你
情话喂你 2021-02-12 10:22

I have a table which has a field `activated_at` timestamp NULL DEFAULT NULL, which means that it can contain a timestamp or it can be null and it\'s

5条回答
  •  伪装坚强ぢ
    2021-02-12 11:05

    $null = new Expression('NULL');
    
    $query->andFilterWhere(['is not', 'asp_id', $null]);
    

    OR

    $query->andFilterWhere(['is', 'asp_id', $null]);
    

提交回复
热议问题