Access: Sum Function

In Access, the Sum function returns the sum of a set of values in a set of values in a select query.

The syntax for the Sum function is:

Sum ( expression )

The expression argument represents a string expression identifying the field that contains the numeric data you want to add or an expression that performs a calculation using the data in that field. Operands in expr can include the name of a table field, a constant, or a function (not one of the other SQL aggregate functions). The Sum function totals the values in a field. It ignores records that contain Null fields.

SQL query

In Access, you can use the Sum function in the query design grid, in an SQL statement in SQL view of the Query window, or in an SQL statement within Visual Basic code. It is used in conjunction with the Group By clause.

Select SellerID, Sum(Price) as TotalSum
From Antiques
Group by SellerID
Having Sum(Price)>57


Leave a Reply

Your email address will not be published.