Subject RE: [firebird-support] Wrong summation within join
Author Leyne, Sean
Frank,

> I have a strange problem with the following clause:
>
> -----------------
> SELECT
> a.ID, a.A1, a.A2,
> SUM(b.B1 * b.B2) AS ValueB,
> SUM(c.C1) AS ValueC
> FROM
> TableA a
> LEFT JOIN TableB b ON b.AID = a.ID
> LEFT JOIN TableC c ON c.AID = a.ID
> GROUP BY
> a.ID, a.A1, a.A2
> ------------------
>
> The first sum is correctly calculated, but the second one is doubled.
> When I remove the first aggragation, then the second value is
correct!?
>
> Any hints are greatly appreciated.

Can you provide a database script which reproduces this problem?

I should point out that before a production release takes place, the
engine is passed through a set of regression tests, to ensure that the
engine produces consistent/accurate results.

So if this is true, this is a serious problem/bug.


Sean Leyne
Firebird Project Admin