Reported By: Michael Reported On: 8/15/2001 For: Version 2.11 Build 1
# 899Using SQL HAVING Clause Containing Two SUM Aggregates from Different Tables Causes Incorrect Results The following query should return the first 2 rows only instead of 3.
Select A.Key, sum(A.Val),Sum(B.Val)
FROM TEST1 A
INNER JOIN TEST2 B ON A.KEY=B.KEY
GROUP BY 1
HAVING sum(A.Val)= sum(B.Val)
CommentsProblem was with the DBISAM engine locating the source table for the SUM aggregate functions properly, resulting in the same A.Val column being used for both SUM expressions in the HAVING clause.
ResolutionFixed Problem on 8/17/2001 in version 2.12 build 1