Sally Sally - 2 years ago 158
MySQL Question

MySQL Truncating of result when using Group_Concat and Concat

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', 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
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

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)

Answer Source

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

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download