The query below is truncated,with 'created' showing only 'cre'(scroll to the right most first:):
mysql> SELECT GROUP_CONCAT(CONCAT('<comment><body><![CDATA[',body,']]></body>','<replier>',if(uid is not null,uid,''),'</replier>','<created>',created,'</created></comment>') SEPARATOR '')
-> FROM idiscussion
->
-> WHERE idiscussion.iask_id = 1;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GROUP_CONCAT(CONCAT('<comment><body><![CDATA[',body,']]></body>','<replier>',if(uid is not null,uid,''),'</replier>','<created>',created,'</created></comment>') SEPARATOR '') |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| <comment><body><![CDATA[haha]]></body><replier></replier><created>2009-05-27 04:57:51</created></comment><comment><body><![CDATA[haha]]></body><replier></replier><created>2009-05-27 04:57:52</created></comment><comment><body><![CDATA[haha]]></body><replier></replier><created>2009-05-27 04:57:52</created></comment><comment><body><![CDATA[haha]]></body><replier></replier><created>2009-05-27 04:57:53</created></comment><comment><body><![CDATA[r]]></body><replier></replier><created>2009-05-29 21:55:44</created></comment><comment><body><![CDATA[s]]></body><replier></replier><created>2009-05-29 23:04:39</created></comment><comment><body><![CDATA[dddret]]></body><replier></replier><created>2009-05-29 23:15:41</created></comment><comment><body><![CDATA[sser]]></body><replier></replier><created>2009-05-29 23:17:13</created></comment><comment><body><![CDATA[aaaaaaassaaaaaa]]></body><replier></replier><created>2009-05-29 23:23:32</created></comment><comment><body><![CDATA[testjjjjjjjjjjj]]></body><replier></replier><cre |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
Here is datable structure and data records:
mysql> show create table idiscussion;
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| idiscussion | CREATE TABLE `idiscussion` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`iask_id` int(10) unsigned DEFAULT NULL,
`ianswer_id` int(10) unsigned DEFAULT NULL,
`uid` int(10) unsigned DEFAULT NULL,
`body` varchar(600) NOT NULL,
`created` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `i_idiscussion_uid` (`uid`),
KEY `i_idiscussion_iask` (`iask_id`),
KEY `i_idiscussion_ianswer` (`ianswer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8 |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select *from idiscussion;
+----+---------+------------+------+----------------------------+---------------------+
| id | iask_id | ianswer_id | uid | body | created |
+----+---------+------------+------+----------------------------+---------------------+
| 1 | 1 | NULL | NULL | haha | 2009-05-27 04:57:51 |
| 2 | 1 | NULL | NULL | haha | 2009-05-27 04:57:52 |
| 3 | 1 | NULL | NULL | haha | 2009-05-27 04:57:52 |
| 4 | 1 | NULL | NULL | haha | 2009-05-27 04:57:53 |
| 5 | NULL | 1 | NULL | hey! | 2009-05-29 01:56:22 |
| 6 | NULL | 1 | NULL | hey! | 2009-05-29 01:56:23 |
| 7 | NULL | 1 | NULL | hey! | 2009-05-29 01:56:25 |
| 8 | NULL | 2 | NULL | hey! | 2009-05-29 01:56:44 |
| 13 | NULL | 1 | NULL | haha,works! | 2009-05-29 21:29:50 |
| 14 | 1 | NULL | NULL | r | 2009-05-29 21:55:44 |
| 15 | NULL | 1 | NULL | so | 2009-05-29 21:55:57 |
| 16 | NULL | 2 | NULL | | 2009-05-29 22:05:41 |
| 17 | NULL | 3 | NULL | sss | 2009-05-29 22:16:27 |
| 18 | NULL | 3 | NULL | hi | 2009-05-29 23:00:10 |
| 19 | NULL | 1 | NULL | hi | 2009-05-29 23:03:06 |
| 20 | 1 | NULL | NULL | s | 2009-05-29 23:04:39 |
| 21 | 1 | NULL | NULL | dddret | 2009-05-29 23:15:41 |
| 22 | 1 | NULL | NULL | sser | 2009-05-29 23:17:13 |
| 23 | 1 | NULL | NULL | aaaaaaassaaaaaa | 2009-05-29 23:23:32 |
| 24 | NULL | 1 | NULL | aasasqwqwqw aa | 2009-05-29 23:23:56 |
| 25 | NULL | 6 | NULL | dianpinyixia... | 2009-05-30 00:58:04 |
| 26 | 1 | NULL | NULL | testjjjjjjjjjjj | 2009-06-15 23:12:58 |
| 27 | 1 | NULL | NULL | hhhhhhhhhhhhhhhhhhh | 2009-06-15 23:14:08 |
| 28 | 1 | NULL | NULL | hey.................. | 2009-06-15 23:18:47 |
| 29 | NULL | 6 | NULL | kkkkkkkkkkkkkkkkkkkkk | 2009-06-15 23:22:30 |
| 30 | NULL | 6 | NULL | jjjjjjjjjjjjjjjjj | 2009-06-15 23:24:58 |
| 31 | NULL | 6 | NULL | ssssssssssssssssssssssssss | 2009-06-15 23:26:01 |
| 32 | 1 | NULL | NULL | hahahahhaahhahahah | 2009-06-15 23:26:30 |
| 33 | 1 | NULL | 4 | .faint................. | 2009-06-15 23:28:16 |
+----+---------+------------+------+----------------------------+---------------------+
29 rows in set (0.00 sec)
It's a configuration setting:
group_concat_max_len=4096
in my.cnf
or
SET GLOBAL group_concat_max_len=4096