HELP - Me again

M

Mr. Capuchino

I have two tables..
Both have field names (AccountDescription, Amount, WTAX, InputTAX, NetofVAT,
StatementCode)
The Statement Code is either a BS or P&L.
I need one query that will group similar AccountDescriptions, give me the
sum of the Amount, WTAX, InputTAX, NetofVAT for BS on both the tables and
another for P&L on both tables. Please help on how to do this...
 
L

Lynn Trapp

Let me start by asking you a question: Why do you have 2 tables with
identical field names? Storing data redundantly or in multiple sources is
not good design and makes doing what you want to do difficult, at best. For
this purpose, and your future sanity, I recommend that you merge the tables
together into one. You can do that with a union query.

Select * from TableOne
UNION
Select * from TableTwo;

The do a Make Table query to create your new table.

Create Table NewTable AS
Select * From YourUnionQuery;

From that new table you can now easily do a query to get what you want:

Select AccountDescription, Sum(Amount), Sum(WTAX),
Sum(InputTAX), Sum(NetofVAT)
From NewTable
Group By AccountDescription;

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Big List: www.ltcomputerdesigns.com/JCReferences.html
 
Top