2011-06-08 43 views
0

我有这样的子查询限制:笨不显示

$this->db->select('(select var_value from contents where table = "products" and table_id = products.id and var_name = "image" and name = "images" order by id asc limit 1) as main_picture');

$this->db->where('category_id', $cat)->from('products')->limit($limit, $start)->get();

的问题是,笨被删除 “限制1” 的子查询里面...

任何建议?

Thx!

回答

2

不能使用LIMIT$this->db->select();方法
请参阅活动记录documentation

  • $this->db->get();

  • $this->db->get_where();

是唯一的方法,允许使用LIMIT

+0

所以,我不能把一个限制1内的子查询? – jplozano 2011-06-10 23:39:36

+0

这是正确的jplozanojuan – Pav 2011-06-11 00:54:42