You need to sign in to do that
Don't have an account?
Problem with SUM()
Hi,
I am query the data base to get the SUM(Amount__c), the table has 6 records with amounts 100 and 10. How Can it be possible that the SUM gives me 74.0?
Here is the the data saved in the LedgerTransaction__c table:
[SELECT Amount__c
FROM LedgerTransaction__c where
and Transaction_Type__c = 'Cash In'
and Ledger_Summary__c = 'a1220000000LPDJAA4'];
Result:
(LedgerTransaction__c:{Id=a0PS0000000zGrMMAU, Amount__c=100.00}, LedgerTransaction__c:{Id=a0PS0000000zJ49MAE, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4EMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4OMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4TMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ7cMAE, Amount__c=10.00})
[SELECT SUM(Amount__c),COUNT(Id)
FROM LedgerTransaction__c
and Transaction_Type__c = 'Cash In'
and Ledger_Summary__c = 'a1220000000LPDJAA4'
GROUP BY Ledger_Summary__c];
Result: (AggregateResult:{expr0=74.0, expr1=6})
Any Ideas?
I know why :)
The Amount is in different currencies