is there a length limit to group_concat or another reason why it would not work on a text field

扶醉桌前 提交于 2019-11-26 16:54:02

问题


First, here is the query:

SELECT GROUP_CONCAT(title) title, GROUP_CONCAT(description) description,
skill_id, count(*)

FROM jobs j
INNER JOIN job_feed_details d
ON j.id = d.job_id
JOIN jobs_skills js
ON j.id = js.job_id
    WHERE moderated = 1
    group by skill_id

Everything works as expected except the description field only returns one result, instead of a concatenation of all results. I suspect this is because the description is a text field, but I cannot find anything about why concatenation would not work with a text field.

Anyone know why this would not work?


回答1:


The group_concat result length is limited(truncated) to the value of the group_concat_max_len system variable. The default value of this variable is 1024.

If you want change the value of the variable the syntax is:

SET [GLOBAL | SESSION] group_concat_max_len = val;

More info Mysql 5 docs



来源:https://stackoverflow.com/questions/5445048/is-there-a-length-limit-to-group-concat-or-another-reason-why-it-would-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!