smartweb 发表于 2011-5-29 23:51:56

如何查找数据库中某字段不为空的记录

有字段CN,如何查找字段CN不为空的记录?

smartweb 发表于 2011-5-29 23:59:31

if($fl){
                if ($fl=="cn")                $this->db->where('cn !=', 'NULL');
                if ($fl=="hk")                $this->db->where('hk !=', 'NULL');
                }

smartweb 发表于 2011-5-29 23:59:47

if($fl){
                if ($fl=="cn")                $this->db->where('cn !=', '');
                if ($fl=="hk")                $this->db->where('hk !=', '');
                }

zhouli520 发表于 2011-5-30 12:33:30

本帖最后由 zhouli520 于 2011-5-30 12:33 编辑

where cn is not null

visvoy 发表于 2011-5-31 08:47:59

$this->db->where('length(trim(cn)) !=', "''", false);
页: [1]
查看完整版本: 如何查找数据库中某字段不为空的记录