How do I create a calculated field in a query

P

Patty Stoddard

I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a query?
 
O

Ofer Cohen

Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name
 
J

Jerry Whittle

In query design view, pull down the Amount field.
Then go up to View, Totals.
Back down under Amount change Group By to Sum.
 
P

Patty Stoddard

Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Ofer Cohen said:
Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name

--
Good Luck
BS"D


Patty Stoddard said:
I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a query?
 
O

Ofer Cohen

What is the error you getting?

--
Good Luck
BS"D


Patty Stoddard said:
Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Ofer Cohen said:
Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name

--
Good Luck
BS"D


Patty Stoddard said:
I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a query?
 
K

KARL DEWEY

Seems like a homework question in that a lot of folks have the exact same
table, filed, and requirement.
 
J

John W. Vinson

Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Using the reserved word SUM as a fieldname, for one thing.

John W. Vinson [MVP]
 
J

John Spencer

The word SUM is a reserved word in Access SQL. Try replacint that as
the alias of the column or surround Sum with [].

SELECT Sum([Check Amount]) as [Sum] ...

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================


Patty said:
Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Ofer Cohen said:
Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name

--
Good Luck
BS"D


Patty Stoddard said:
I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a query?
 
Top