codeigniter,活动记录,有问题
问题描述:
我有一个代码点火器有子句的问题。codeigniter,活动记录,有问题
我需要生成以下SQL与活动记录:
SELECT *
FROM A
GROUP BY A.X
HAVING A.Y = 'test'
但是,使用下面的代码:
$this->db->select('*');
$this->db->from('A');
$this->db->group_by('A.X');
$this->db->having('A.Y','frontend');
产地:
SELECT *
FROM A
GROUP BY A.X
HAVING A.Y = test
而且似乎不可能逃脱字符串值...或者是它?
答
写这样一个笨拙的方式having子句:
$this->db->having('A.Y = "frontend"', null, false);
+0
这是正确的方法!谢谢,请接受你的答案。 – MatterGoal 2011-06-17 09:09:40
*(阿里纳斯)*代码点火器的[ActiveRecord的(http://martinfowler.com/eaaCatalog/activeRecord.html)的定义是错误的。如果有的话,这是一个非常简单的[QueryObject](http://martinfowler.com/eaaCatalog/queryObject.html)。 – Gordon 2011-03-23 10:23:38
'前端'如何产生'测试'? – 2011-03-23 14:07:15