select id from
(
select t1.id,t1.parent_id,
if(find_in_set(parent_id, @pids) > 0, @pids := concat(@pids, ',', id), 0) as ischild
from (
select id,parent_id from t_pem_event_type t
) t1,
(select @pids := #{parentId}) t2
) t3 where ischild != 0;
mysql根据父节点查询下面所有子节点
最新推荐文章于 2024-07-30 03:51:48 发布