R
Rusty Jones
I have three tables:
Accounts - store an id and information about the account.
External Transfer - stores an account id and the amount transfered into the
account
Internal Transfer - transfer from one account to another (from account, to
account, and amount)
I want a query that computes the balance in each account. The balance is
the sum of all the external transfers plus the internal transfers into the
account minus the internal transfers that go from the account.
Any time I try to build a query to do this I end up with some of the values
used twice.
Any ideas?
Accounts - store an id and information about the account.
External Transfer - stores an account id and the amount transfered into the
account
Internal Transfer - transfer from one account to another (from account, to
account, and amount)
I want a query that computes the balance in each account. The balance is
the sum of all the external transfers plus the internal transfers into the
account minus the internal transfers that go from the account.
Any time I try to build a query to do this I end up with some of the values
used twice.
Any ideas?