How to write WHERE NOT IN on a subquery using CodeIgniter's query builder
05:30 11 Feb 2017

How can I fetch all users where user_id in tbl_attendance not having current date with application_status 3 and 4

attendance_id   user_id      date_in        attendance_status status 0=absent 1=present 3 = onleave 4 = onoff
    1            1          2017-02-05      1
    2            36         2017-02-11      4
    3            36         2017-02-11      4
    4            36         2017-02-11      3
    5            1          2017-02-02      1
    6            36         2017-02-01      1

My code is like this

$date=date('Y-m-d');
$this->db->where('tbl_users.user_id NOT IN(SELECT user_id FROM tbl_attendance WHERE tbl_attendance.date_in= "'.$date.'" )');
    
$this->db->where_in( 'tbl_attendance.attendance_status', array( '3', '4' ) );

I want to combine those two lines and produce the output like if current date is present in 3 or 4.

php codeigniter subquery query-builder where-in