Hi Access-Friends,
I'm stuckt with the following query: I'd like to build a total sum for the whole year. In table1 is Amount in table2 is the changedAmount. Unfortunately, I got a wrong Sum. I assume it's because of the 'group by' function. Am I on the right track?
Thanx for any suggestions,
Key
SELECT Sum(Table1.Amount) AS SumOfAmount, Sum(Table2.ChangedAmount) AS SumOfChangedAmount, Table1.AccNo, Table1.Year, Sum(([Amount]+[ChangedAmount])) AS Expr1
FROM Table1 LEFT JOIN Table2 ON (Table1.Year = Table2.Year) AND (Table1.Month = Table2.Month) AND (Table1.AccNo = Table2.AccNo)
GROUP BY Table1.AccNo, Table1.Year
HAVING (((Table1.AccNo)=100) AND ((Table1.Year)=2003));
I'm stuckt with the following query: I'd like to build a total sum for the whole year. In table1 is Amount in table2 is the changedAmount. Unfortunately, I got a wrong Sum. I assume it's because of the 'group by' function. Am I on the right track?
Thanx for any suggestions,
Key
SELECT Sum(Table1.Amount) AS SumOfAmount, Sum(Table2.ChangedAmount) AS SumOfChangedAmount, Table1.AccNo, Table1.Year, Sum(([Amount]+[ChangedAmount])) AS Expr1
FROM Table1 LEFT JOIN Table2 ON (Table1.Year = Table2.Year) AND (Table1.Month = Table2.Month) AND (Table1.AccNo = Table2.AccNo)
GROUP BY Table1.AccNo, Table1.Year
HAVING (((Table1.AccNo)=100) AND ((Table1.Year)=2003));