getChildLst函数如下:
DROP FUNCTION `getChildLst`//
CREATE DEFINER=`root`@`localhost` FUNCTION `getChildLst`(rootId INT) RETURNS varchar(1000) CHARSET latin1
Begin
Declare sTemp varchar(1000);
Declare sTempChd varchar(1000);
Set sTemp = '$';
Set sTempChd = cast(rootId as CHAR);
While sTempChd is not null Do
Set sTemp = concat(sTemp,',',sTempChd);
Select group_concat(id) into sTempChd from comments where find_in_set(pid,sTempChd)>0;
End While;
Return sTemp;
End
这是网上的一段函数,菜鸟未能理解,请ACMAIN_CHM版主帮忙看一下如何改,非常感谢。