Subject Re: [firebird-support] Wrong summation within join
Author Arno Brinkman
Hi,

> 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.

What do you meant with removing the first aggregation? Removing a LEFT JOIN
as well?

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/

Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://80.126.130.81