标签:
--由父项递归下级 with cte(refid,pid,zname,code) as (--父项 select refid,pid,zname,code from zuzhi where pid = 38 union all --递归结果集中的下级 select t.refid,t.pid,t.zname,t.code from zuzhi as t inner join cte as c on t.pid = c.refid ) select refid,pid,zname,code from cte
标签:
原文地址:http://www.cnblogs.com/lindaguoflh/p/4758357.html