select ID ,name from (
select t1.ID,t1.PARENTID,name,
if(find_in_set(PARENTID, @pids) > 0, @pids := concat(@pids, ',', ID), 0) as ischild
from (
select t.ID,PARENTID,t.NAME as name from hn_cultivate_department t order by PARENTID, ID
) t1,
(select @pids := 5246) t2
) t3 where ischild != 0
mysql 的递归方法 查询pid为 5246
最新推荐文章于 2024-08-19 16:10:28 发布
关键词由优快云通过智能技术生成