Обходной путь
Один из вариантов - заполнить значения пробелами #
.Таким образом, каждый элемент в group_concat имеет одинаковую длину.
Предположим, что нет элементов длиной более 20 символов.
Тогда ваш запрос будет:
SET group_concat_max_len = 10*20+9; /*execute this first.*/
/*10 items, 20 bytes each + 9 bytes for the separator*/
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`, /* LATEST DATE*/
MAX((docID)) AS docID, /* LATEST DOC*/
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
Просто напомнить1013 *
x= CONCAT(repeat('#',20),docID) adds 20 x #################### in front of docID
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,'#','') removes the `#` so the result looks normal.
Или напишите свою собственную версию group_concat
Вы можете использовать свой собственный UDF group_concat.
В сети есть несколько примеров.
Например: http://www.codeproject.com/KB/database/mygroupconcat.aspx?display=Mobile