在MySQL配置文件/etc/my.cnf中加上
group_concat_max_len = -1 # -1为最大值或填入你要的最BEGINDECLARE sTemp VARCHAR(40000);DECLARE sTempChd VARCHAR(40000); SET sTemp = '$';SET sTempChd = CAST(id_str AS CHAR);WHILE sTempChd IS NOT NULL DO SET sTemp = CONCAT(sTemp,',',sTempChd); SELECT GROUP_CONCAT(category_id) INTO sTempChd FROM ad_category WHERE FIND_IN_SET( parent_id,sTempChd )>0;END WHILE; RETURN sTemp; END
大长度