阅读背景:

MySQL递归查询所有下级节点_LeeShaoQing的博客_mysql查询下级

来源:互联网 

MySQL递归查询所有下级节点。

先上SQL后来讲解其中的含义。

select id from (
              select t1.id,t1.inviteId,
              if(find_in_set(inviteId, @pids) > 0, @pids := concat(@pids, ',', id), 0)  as isbig
              from (
                   select id,inviteId from customer t order by id, inviteId
                  ) t1,
                  (select @pids := 2009812) t2
             ) t3 where isbig>0;
sel



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: