select *,ischild from (
select t1.*,
if(find_in_set(pid, @pids) > 0, @pids := concat(@pids, ',', id ), 0) as ischild
from (
select * from hqf_member t order by pid, id
) t1,
(select @pids :=上级ID ) t2
) t3 where ischild
select *,ischild from (
select t1.*,
if(find_in_set(pid, @pids) > 0, @pids := concat(@pids, ',', id ), 0) as ischild
from (
select * from hqf_member t order by pid, id
) t1,
(select @pids :=上级ID ) t2
) t3 where ischild