codeigniter - subquery limit not showing
I have this:
$this->db->select('(select var_value from contents where table = "products" and table_id = products.id and var_name = "image" and n开发者_JAVA技巧ame = "images" order by id asc limit 1) as main_picture');
$this->db->where('category_id', $cat)->from('products')->limit($limit, $start)->get();
The problem is that codeigniter is removing the "limit 1" inside the subquery...
Any advice?
Thx!
You can not use LIMIT
inside $this->db->select();
method
Please refer to Active Record documentation
$this->db->get();
$this->db->get_where();
Are the only methods that allow the use of LIMIT
精彩评论