Please Help

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

Guest

I have several transaction tables such as Purchasing, Transfer Accounts,
Sales that has AccountID on each one of them that tell where the money taken
from, or went to. How is the query and relationship like if I want it like:

AccountID SumOfSales SumOfPurchasing SumOfTransfer
Petty Cash $100 $30 $10
Bank $50 $0 $10
Petty Cash2 $0 $0 $0
Thank u so much for your help.
 
Toar said:
I have several transaction tables such as Purchasing, Transfer Accounts,
Sales that has AccountID on each one of them that tell where the money taken
from, or went to. How is the query and relationship like if I want it like:

AccountID SumOfSales SumOfPurchasing SumOfTransfer
Petty Cash $100 $30 $10
Bank $50 $0 $10
Petty Cash2 $0 $0 $0


I thik this may be what you want:

SELECT A.AccountID,
Sum(S.amount) As SumOfSales,
Sum(P.amount) As SumOfPurchasing
Sum(T.amount) As SumOfTransfer
FROM ((Accounts As A
LEFT JOIN Sales As S
ON A.AccountID = S.AccountID)
LEFT JOIN Purchases As P
ON A.AccountID = P.AccountID)
LEFT JOIN Transfers As T
ON A.AccountID = T.AccountID
GROUP BY A.AccountID
 

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

Back
Top