[英]How to set group_concat_max_len in codeigniter active record?
我曾試圖設置group_concat_max_len
與笨$this->db->query('SET GLOBAL group_concat_max_len=15000')
但它不工作。
我嘗試過:
$q = 'SET GLOBAL group_concat_max_len=15000';
$this->db->query($q);
$this->db->select("group_concat(id) ids");
$this->db->from("table_name");
$data = $this->db->get()->row_array();
但這並不能提供所有數據。 對此有任何想法。 謝謝!!!
我通過使用SET SESSION
而不是SET GLOBAL
找到了解決方案。
代碼如下:
$this->db->simple_query('SET SESSION group_concat_max_len=15000');
$this->db->select("group_concat(id) ids");
$this->db->from("table_name");
$data = $this->db->get()->row_array();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.