sum
Compute the sum of the results for an aggregate
Syntax
sum([DISTINCT] arith_expr)
Arguments
| arith_expr | The arithmetic expression which will be summed. |
Description
This function computes the sum of the values of each arith_expr over all rows in each aggregate.
If distinct is specified, duplicate rows are not included in the computation.
Example
open nsfawards;
select state, sum(amount) from sponsor, award
where sponsor_nm = name
group by 1 having count(*) >= 100;
state sum(amount)
AK 228247188
AL 252256166
AR 86861271
AZ 707834828
CA 6058460900
CO 1616818666
...
VT 92312263
WA 890236270
WI 777492186
WV 1193394148
WY 85064301