如有这么一段:
DROP TEMPORARY TABLE if exists tmp_table; CREATE TEMPORARY TABLE tmp_table SELECT A.`id`,A.`leftId`,A.`rightId`,A.`pid`, ( SELECT group_concat(CAST(B.`id` as char)) as idStr FROM `product_sort_tree_node` as B WHERE B.`treeId` = A.`treeId` AND B.`leftId` between A.`leftId` AND A.`rightId` ) as idStr FROM `product_sort_tree_node` as A WHERE FIND_IN_SET(CAST(`id` as char),vSubNodeIdStr);
把所有子节点的ID,用逗号分隔拼起来, group_concat(CAST(B.`id` as char)) as idStr
当节点比较多的时候,就报错: row 1 was cut by group_concat()
搜了一下,group_concat有个默认的最大拼接长度,好像是1024 太小了。 ================================================================== 在执行之前,来一句: SET group_concat_max_len=200000; 妥妥的~~~
|