Sql Server 中树结构表 用父节点的值减去子节点值的和

update TID set cvalue = value - (select sum(value) as sv from TID as t1 where t1.id != TID.id and t1.pid = TID.id)

原文地址:https://www.cnblogs.com/BH-RJ-WK/p/12877457.html