2011-06-08 53 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