Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 

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)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
662 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...