2
我有一个person id表作为包含其管理员id的主键。我想设置一个while循环,它将显示该人员的所有经理id,一直到列表顶部。我构建了一个while循环,但它返回null。我究竟做错了什么?mysql while循环返回null
CREATE FUNCTION `whilefunction`() RETURNS varchar(255)
BEGIN
declare l_loop varchar(25) default '123456';
declare result varchar(255) default '';
while l_loop is not null do
set result = result + (select managerid from table where personid = l_loop);
set l_loop = (select managerid from table where personid = l_loop);
end while;
RETURN result;
END
我会继续前进,现在捂脸超硬。非常感谢! –