Sum the row values

G

Guest

Hi:

I have 2 tables that have common structure. Both have 2 columns, (1)
Account Title and (2) Amount. I want to sum the rows of the 2 tables.

Example:

Table1

Account Amount
--------- ---------
Cash 400
A/R 100
Inventory 200
PPE 100


Table2

Account Amount
--------- ---------
Cash 500
A/R 600
Inventory 500
PPE 800

The query should sum each row, How will i do this. The query should report
the ff:

Query results.

Account Amount
--------- ---------
Cash 900
A/R 700
Inventory 700
PPE 900

Thanks in advance.
 
D

Duane Hookom

You could first union the tables
SELECT Account, Amount
FROM Table1
UNION ALL
SELECT Account, Amount
FROM Table2;

Then create a totals query based on your union query
SELECT Account, Sum(Amount0 As Amt
FROM qYourUnionQuery
GROUP BY Account;
 
G

Guest

You did great. Thank a lot
--
Allan

Duane Hookom said:
You could first union the tables
SELECT Account, Amount
FROM Table1
UNION ALL
SELECT Account, Amount
FROM Table2;

Then create a totals query based on your union query
SELECT Account, Sum(Amount0 As Amt
FROM qYourUnionQuery
GROUP BY Account;
 

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