我有这个:
$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();
问题是codeigniter正在删除子查询中的“限制1”...
有什么建议吗?
THX!
答案 0 :(得分:2)
您无法在LIMIT
方法中使用$this->db->select();
请参阅活动记录documentation
$this->db->get();
$this->db->get_where();
是否允许使用LIMIT