日期:2014-05-16 浏览次数:20603 次
DROP FUNCTION IF EXISTS getChildLst; CREATE FUNCTION `getChildLst`(rootId INT) RETURNS varchar(1000)
BEGIN DECLARE sTemp VARCHAR(1000); DECLARE sTempChd VARCHAR(1000); SET sTemp = '0'; SET sTempChd =cast(rootId as CHAR);
WHILE sTempChd is not null DO SET sTemp = concat(sTemp,',',sTempChd); SELECT group_concat(id) INTO sTempChd FROM t_app_task where
FIND_IN_SET(task_parent,sTempChd)>0; END WHILE; RETURN sTemp; END