先来看一个例子: 不获取 id 也可以使用 id 元素. <!-- Author: XiaoWen Create a file: 2017-01-11 13:58:01 Last modified: 2017-01-11 14:00:28 Start to work: Finish the work: Other information: --> <!DOCTYPE html> <html lang="en"> <head> <me
Declare @Id Int Set @Id = 5; ---在此修改父节点 With RootNodeCTE(Id,ParentId) As ( Select Id,ParentId From BOM Where ParentId In (@Id) Union All Select BOM.Id,BOM.ParentId From RootNodeCTE Inner Join BOM On RootNodeCTE.Id = BOM.ParentId ) Se