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