codeigniter 3 中的 Postgresql 查询 returns null 当不在函数中使用时
Postgresql query in codeigniter 3 returns null when using not in function
我是第一次使用postgresql,遇到这样的问题,我就一头雾水。起初,当我使用这段代码时,一切都很顺利
$this->db->select('*');
$this->db->from('pegawai');
$query = $this->db->get();
return = $query->result();
但是,当我使用 not in 时,它 returns array(0) { }
这是代码
$this->db->select('*');
$this->db->from('pegawai');
$this->db->where('pegawai.id_pegawai not in (select id_pegawai from user)');
$query = $this->db->get();
return $query->result();
它应该显示 2 条记录,因为我为此查询创建了 2 个虚拟对象。任何人都可以帮助我吗?
谢谢
$this->db->select('*');
$this->db->from('pegawai');
$this->db->join('user', 'user.id_pegawai = pegawai.id_pegawai', 'left');
$this->db->where('user.id_pegawai is null');
$query = $this->db->get();
return $query->result();
已经找到了:D
我是第一次使用postgresql,遇到这样的问题,我就一头雾水。起初,当我使用这段代码时,一切都很顺利
$this->db->select('*');
$this->db->from('pegawai');
$query = $this->db->get();
return = $query->result();
但是,当我使用 not in 时,它 returns array(0) { } 这是代码
$this->db->select('*');
$this->db->from('pegawai');
$this->db->where('pegawai.id_pegawai not in (select id_pegawai from user)');
$query = $this->db->get();
return $query->result();
它应该显示 2 条记录,因为我为此查询创建了 2 个虚拟对象。任何人都可以帮助我吗? 谢谢
$this->db->select('*');
$this->db->from('pegawai');
$this->db->join('user', 'user.id_pegawai = pegawai.id_pegawai', 'left');
$this->db->where('user.id_pegawai is null');
$query = $this->db->get();
return $query->result();
已经找到了:D