mysql 根据父id 递归查询所有的子类

方法一、mysql中建立递归查询的方法

-- DROP FUNCTION `getChildrenOrg` 
CREATE FUNCTION `getChildrenOrg`(uuid INT) RETURNS text CHARSET utf8
BEGIN
	DECLARE sTemp text;
	DECLARE sTempChd text;
 
	SET sTemp = '$';
	SET sTempChd =cast(uuid as CHAR);
WHILE sTempChd is not null DO
 
	SET sTemp = concat(sTemp

你可能感兴趣的:(MyBatis,MySQL,java,mysql,递归)