sum two seprate fields in query

T

TKM

How do I take two fields from two seprate tables and SUM them in a query?
[table1].[field1].what goes here[table2].[field2]
then put SUM in the total field? What would go between the two fields above
because I am not adding, subtracting etc
 
S

Steve Schapel

TKM,

I don't understnad what Sum means, in the context of the total of the
values of 2 fields, if it doesn't mean Add. Can you please say what
this data is about, and give an example?
 
J

John Vinson

How do I take two fields from two seprate tables and SUM them in a query?
[table1].[field1].what goes here[table2].[field2]
then put SUM in the total field? What would go between the two fields above
because I am not adding, subtracting etc

If you want the sum of Field1 and Field2 - i.e. if Field1 contains 2
and Field2 contains 3 you want a result of 5 - then you ARE simply
adding:

Result: [Table1].[Field1] + [Table2].[Field2]

If that's not what you want... please explain.

John W. Vinson[MVP]
 
T

TKM

John thanks again for helping out a beginner. It is most appreciated.

John Vinson said:
How do I take two fields from two seprate tables and SUM them in a query?
[table1].[field1].what goes here[table2].[field2]
then put SUM in the total field? What would go between the two fields above
because I am not adding, subtracting etc

If you want the sum of Field1 and Field2 - i.e. if Field1 contains 2
and Field2 contains 3 you want a result of 5 - then you ARE simply
adding:

Result: [Table1].[Field1] + [Table2].[Field2]

If that's not what you want... please explain.

John W. Vinson[MVP]
 
S

Steve Schapel

Michael,

If you mean that Field8 is a field in your table, and you want to put a
calculated value into this field, then this is almost certainly not
appropriate. This is the whole point of the query, as suggested by John
Vinson... the calculated value is returned by the query itself, not
stored in the table. So I think the Field8 can be deleted from the table.

So, we are talking about a Select query.

Make a query, in design view, based on your table. Add the fields that
you want returned by the query into the query design grid. And then, in
the Field row of a blank column in the query design grid, you create a
calculated field. First, you give the field a name, followed by a : and
then type in the expression for the calculation. So in your example,
this might look like this...
Difference: [Field7]-[Field6]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top