Hello all,
I'm having the following problem,
I have three tables, Person, Income, Outcome
Person has the primary key : ID
Income has two fields : PersonID [Foreign] and IncomeAmount
Outcome has two fields : PersonID [foreign] and OutcomeAmount
I need to make a query that gets the summation of IncomeAmount and the summation of OutcomeAmount for each personID
My Query which gets totally wrong data is:
SELECT Person.ID, Sum(Income.IncomeAmount) , Sum(Outcome.OutcomeAmount)
From Person,Outcome,Income
Where Person.ID = Income.PersonID AND Person.ID = Outcome.PersonID
Group by Person.ID
Why does it gets wrong data?
what am I missing here ?
thanks