今天算是浪费了大半天了!!!!
select group_concat( rights.url) from p_rights rights , p_role_right roleright where rights.id=roleright.right_id and roleright.role_id =1
查询出来有数据
select group_concat(distinct rights.url) from p_rights rights , p_role_right roleright where rights.id=roleright.right_id and roleright.role_id =1
居然查不到数据
原来 distinct 后 url的顺序 重复的会显示到后面去。
而 group_concat查询的结果默认长度1024, 导致 数据丢失
SET GLOBAL group_concat_max_len=102400;
充值 mysql客户端 即可有效。
我还是写到 my.cnf中去把
group_concat_max_len = 102400
本文探讨了在MySQL中使用Group Concat函数时遇到的数据丢失问题。通过调整group_concat_max_len参数值,解决了因默认长度限制导致的数据不完整情况。

被折叠的 条评论
为什么被折叠?



