G
Guest
One of our users reported this:
This is a sample of my database that illustrates the bug I found.
My query is searching for all records whose sum of the percentage is not
equal to 100% (1). It looks like this, very simple, but result show some
records with 100% (1) which is incorrect.
SELECT tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID,
Sum(tblCEMActivityAllocation.Percentage) AS SumOfPercentage FROM
tblCEMActivityAllocation GROUP BY tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID
HAVING (((Sum(tblCEMActivityAllocation.Percentage))<>1));
The only way I made it work was by converting the sum of the percentage to a
string and compare it's result to a string value of "1", that gives me a
correct result, but arithmetically is not right.
SELECT tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID,
Sum(tblCEMActivityAllocation.Percentage) AS SumOfPercnt FROM
tblCEMActivityAllocation GROUP BY tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID
HAVING (((CStr(Sum([tblCEMActivityAllocation].[Percentage])))<>"1"));
Any comments?
Thanks.
This is a sample of my database that illustrates the bug I found.
My query is searching for all records whose sum of the percentage is not
equal to 100% (1). It looks like this, very simple, but result show some
records with 100% (1) which is incorrect.
SELECT tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID,
Sum(tblCEMActivityAllocation.Percentage) AS SumOfPercentage FROM
tblCEMActivityAllocation GROUP BY tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID
HAVING (((Sum(tblCEMActivityAllocation.Percentage))<>1));
The only way I made it work was by converting the sum of the percentage to a
string and compare it's result to a string value of "1", that gives me a
correct result, but arithmetically is not right.
SELECT tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID,
Sum(tblCEMActivityAllocation.Percentage) AS SumOfPercnt FROM
tblCEMActivityAllocation GROUP BY tblCEMActivityAllocation.ActivityID,
tblCEMActivityAllocation.SubActivityID
HAVING (((CStr(Sum([tblCEMActivityAllocation].[Percentage])))<>"1"));
Any comments?
Thanks.