使用Group_Concat和Concat时MySQL截断结果 [英] MySQL Truncating of result when using Group_Concat and Concat

查看:98
本文介绍了使用Group_Concat和Concat时MySQL截断结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下SQL(我已删除了一些selesct fi:

I have the following SQL (I have removed some of the selesct fi:

SELECT node_revisions.title                          AS 'Task', 
       node_revisions.body                           AS 'Description', 
       Date_format(field_due_date_value, '%e/%c/%Y') AS 'Due Date', 
       users.name                                    AS 'User Name', 
       (SELECT GROUP_CONCAT(Concat(CHAR(10),Concat_ws( ' - ', name, From_unixtime( TIMESTAMP, 
               '%e/%c/%Y' )),CHAR(10),COMMENT))
        FROM   comments 
        WHERE  comments.nid = content_type_task.nid) AS 'Comments' 
FROM   content_type_task 
       INNER JOIN users 
         ON content_type_task.field_assigned_to_uid = users.uid 
       INNER JOIN node_revisions 
         ON content_type_task.vid = node_revisions.vid 
ORDER  BY content_type_task.nid DESC 

这将撤回我的所有任务以及与该任务相关的所有注释.我的问题是评论字段;使用* GROUP_CONCAT *创建的文件将截断输出.我不知道为什么,我也不知道如何克服这个问题. (看起来是341个字符)

This pulls back all my tasks and all comments associated with a task. The problem I am having is that the comments field; created using the *GROUP_CONCAT*, is truncating the output. I don't know why and I don't know how to overcome this. (It looks to be at 341ish chars)

推荐答案

GROUP_CONCAT()默认情况下限制为1024个字节.

GROUP_CONCAT() is, by default, limited to 1024 bytes.

要解决此限制并允许最多100 KB的数据, 在my.cnf中添加group_concat_max_len=102400 或使用SET GLOBAL group_concat_max_len=102400查询服务器.

To work around this limitation and allow up to 100 KBytes of data, add group_concat_max_len=102400 in my.cnf or query the server using SET GLOBAL group_concat_max_len=102400.

这篇关于使用Group_Concat和Concat时MySQL截断结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆