group_concat 是否有长度限制或它不适用于文本字段的其他原因
首先,这是查询:
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
一切都按预期工作,除了描述字段仅返回一个结果,而不是所有结果的串联。我怀疑这是因为描述是一个 text
字段,但我找不到任何有关为什么串联不适用于文本字段的信息。
有人知道为什么这行不通吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
group_concat 结果长度被限制(截断)为 group_concat_max_len 系统变量的值。该变量的默认值为 1024。
如果要更改该变量的值,语法为:
更多信息 Mysql 5 文档
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:
More info Mysql 5 docs