存储过程

-- pro_show_childLst
DELIMITER $$
-- 调用过程输出子节点
CREATE PROCEDURE pro_show_childLst_detail(IN rootId INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmpLst;
CREATE TEMPORARY TABLE IF NOT EXISTS tmpLst
(sno INT PRIMARY KEY AUTO_INCREMENT,id INT,depth INT);

CALL pro_cre_childlist(rootId,0);

SELECT t_team.buyer_id,t_team.p_id,tmpLst.depth,nickname,headimgurl
FROM tmpLst,t_team,t_buyer_user WHERE tmpLst.id=t_team.buyer_id and tmpLst.id=t_buyer_user.id ORDER BY tmpLst.sno;
END$$