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

后端 未结 5 2047
情话喂你
情话喂你 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:17

    // ...WHERE (`status` = 10) AND (`type` IS NULL) AND (`info` IS NOT NULL)
    $query->where([
        'status' => 10,
        'type' => null,
    ])
    ->andWhere(['not', ['info' => null]]);
    

提交回复
热议问题