首页 > 解决方案 > 使用 codeigniter 查询选择属性设置为 null 的字段

问题描述

我正在尝试创建以下语句:

$this->db->where('uu.usuario_grupo_id is null');

但它不起作用

我也试过这个:

$this->db->where('uu.usuario_grupo_id =', null);

$this->db->where('uu.usuario_grupo_id =', 'null');

这些选项都不会从引用为 null 的字段返回数据。

标签: phppostgresqlcodeigniter

解决方案


你可以这样做:

$this->db->where(array('uu.usuario_grupo_id' => NULL));

生产

WHERE `usuario_grupo_id` IS NULL 

推荐阅读