开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜