文章 2014-09-25 来自:开发者社区

SQL递归查询(with cte as)

with cte as(select Id,Pid,DeptName,0 as lvl from Departmentwhere Id = 2union allselect d.Id,d.Pid,d.DeptName,lvl+1 from cte c inner join Department don c.Id = d.Pid)select * from cte 表结构: Id ...

文章 2013-01-25 来自:开发者社区

SQL递归查询(with cte as)

本文转载http://www.cnblogs.com/xqhppt/archive/2011/02/15/1955366.html with cte as(    select Id,Pid,DeptName,0 as lvl from Department  &nbs...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

产品推荐

数据库

分享数据库前沿,解构实战干货,推动数据库技术变革

+关注