用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3563|回复: 3
收起左侧

[已解决] ◆CI里不能使用mysql的ifnull函数吗?◆

[复制链接]
发表于 2010-4-7 22:01:12 | 显示全部楼层 |阅读模式
$this->db->select("a.id, a.name, (a.count - ifnull(b.baseCount, 0)) as curCount");
$this->db->from("t1 a");
$this->db->join("t2 b", "a.id = b.id", "left outer");
return $this->db->get();

这段加上ifnull就会报错,把ifnull去掉就不会报错,请问如何处理?谢谢!
发表于 2010-4-8 00:44:10 | 显示全部楼层
$this->db->select(array("a.id", "a.name", "(a.count - ifnull(b.baseCount, 0)) as curCount"));
 楼主| 发表于 2010-4-8 12:56:38 | 显示全部楼层
$this->db->select(array("a.id", "a.name", "(a.count - ifnull(b.baseCount, 0)) as curCount"));
visvoy 发表于 2010-4-8 00:44



    好,我试试,谢谢先!
发表于 2014-4-9 10:12:40 | 显示全部楼层
成功了,太感谢楼主了

本版积分规则