目的:更新统计子栏目某一个字段的值的总和。
SQL如下:
UPDATE dbms_emag_magazine
SET TotalCount =
(SELECT IsNull(SUM(a.TotalCount), 0)
FROM [dbms_emag_magazine] a
WHERE a.[ParentId] = [dbms_emag_magazine].Id)
WHERE (ParentId = 0)
[责任编辑:jumbot]