select
id,apply_resource_name
from
(
select
t1.id,t1.apply_resource_name,
if(find_in_set(parent_id, @pids) > 0,
@pids := concat(@pids, ',', id),
0) as ischild
from
(
select
id,
parent_id,
apply_resource_name
from
resource_apply_resource t
order by
parent_id,
id ) t1,
(
select @pids := 15) t2 ) t3
where
ischild != 0
注释:@pids := 15的15就是要查询的父节点ID
标签:resource,t1,下级,mysql,apply,pids,id,select From: https://www.cnblogs.com/cuijinlong/p/17176678.html