1

我有一张看起来像这样的桌子:

ID, Weight
_____________
number, Value

现在我想在查询中添加另一列,其中包含每行中所有权重的总和。像这样:

ID, weight, sumOfWeight
_____________________________
number, value, sum of values

sql代码为:

SELECT t.ID, t.weight, sum(t.weight) as sumOfW
FROM Table t

有没有办法在 Microsoft Access 中做到这一点?

4

1 回答 1

3

您可以动态选择

select ID, 
       weight,
       (select sum(weight) from your_table) as sumOfWeight
from your_table
于 2013-11-11T17:34:59.880 回答