sking 发表于 2010-4-7 22:01:12

◆CI里不能使用mysql的ifnull函数吗?◆

$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去掉就不会报错,请问如何处理?谢谢!

visvoy 发表于 2010-4-8 00:44:10

$this->db->select(array("a.id", "a.name", "(a.count - ifnull(b.baseCount, 0)) as curCount"));

sking 发表于 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 http://codeigniter.org.cn/forums/images/common/back.gif


    好,我试试,谢谢先!

被时间思牵 发表于 2014-4-9 10:12:40

成功了,太感谢楼主了:D
页: [1]
查看完整版本: ◆CI里不能使用mysql的ifnull函数吗?◆