How to select rows where column value IS NOT NULL using CodeIgniter's ActiveRecord?

前端 未结 10 1823
太阳男子
太阳男子 2020-12-04 17:15

I\'m using CodeIgniter\'s Active Record class to query the MySQL database. I need to select the rows in a table where a field is not set to NULL:

$this->d         


        
10条回答
  •  半阙折子戏
    2020-12-04 17:50

    CodeIgniter 3

    Only:

    $this->db->where('archived IS NOT NULL');
    

    The generated query is:

    WHERE archived IS NOT NULL;
    

    $this->db->where('archived IS NOT NULL',null,false); << Not necessary

    Inverse:

    $this->db->where('archived');
    

    The generated query is:

    WHERE archived IS NULL;
    

提交回复
热议问题