Operators

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I use the Add Operators to add the field and divide it field or taking the average.
For example, my field "anum" Number is from "atable" Table.
I want to added all "anum" field by all records I have.
Then display it.
Second, another is taking the average. Any possible?
 
If you want just the total and average, do this:

SELECT Sum(anum) As Total, Avg(anum) As Average
FROM atable

If you want to also display the details, use your table as the source for a
report and ask for a Sum and Avg in the report footer. You can do that
easily with the Report Wizard.

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
SELECT Sum([anum]) AS SumOfanum,
Avg([anum]) AS AvgOfanum
FROM [atable];

Using the QBE grid, add the atable, and add the anum field. Click on View -
Totals, and in the Total row choose Sum; you can add the anum field again
and choose Avg in the total row.
 
Back
Top