// Sub Query $this->db->select('id')->from('tasks'); $subQuery = $this->db->get_compiled_select(); // Main Query $this->db->select('*') ->from('employees') ->where("id IN ($subQuery)", NULL, FALSE) ->get() ->result();
// Sub Query $this->db->select('id')->from('tasks'); $subQuery = $this->db->get_compiled_select(); // Main Query $this->db->select('*') ->from('employees') ->where("id IN ($subQuery)", NULL, FALSE) ->get() ->result();