, #. , group_concat .
, 20 .
:
SET group_concat_max_len = 10*20+9;
SELECT country,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),docID),20)),'#','') AS docIDs,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),analyst),20)),'#','') AS analysts,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),region,20)),'#','') AS regions,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),report,20)),'#','') AS reports,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),topic,20)),'#','') AS topics,
MAX((date)) AS `date`,
MAX((docID)) AS docID,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),date,20)),'#','') AS dates,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),event,20)),'#','') AS events,
REPLACE(GROUP_CONCAT(RIGHT(CONCAT(repeat('#',20),province,20)),'#','') AS provinces
FROM reports
GROUP BY country ORDER BY `date` DESC, docID DESC
:
x= CONCAT(repeat('
y= RIGHT(X,20) Takes the rightmost 20 chars of that
z= GROUP_CONCAT(y) strings these together up to max_len
result = REPLACE(z,'
group_concat
group_concat UDF.
.
: http://www.codeproject.com/KB/database/mygroupconcat.aspx?display=Mobile