迭代查询

SQL 迭代查询语句
数据库

SQL 迭代查询语句

30 0

本文摘自cnblogs-Twang,原文连接:https://www.cnblogs.com/wangfuyou/p/7615020.html,侵删。SQL 迭代查询语句-- Get childs by parent id 按父id获取子项WITH TreeAS(SELECT Id,ParentId FROM dbo.Node P WHERE P.Id = 21 -- parent idUNION ALLSELECT C.Id,C.ParentId FRO…