Subject | Re: [firebird-support] SQL Optimation best way |
---|---|
Author | Arno Brinkman |
Post date | 2015-11-04T22:09:42Z |
Hi,
You’re already have good suggestions, but mainly we’re missing input of
what you exactly want and how the data is related.
Here another SQL example which could bring you by a solution:
SELECT
SUM(a.Field3), dt.SumFieldC
FROM
TableA a
LEFT JOIN (SELECT b.FieldA, b.FieldB, SUM(b.FieldC) AS SumFieldC
FROM TableB b GROUP BY b.FieldA, b.FieldB) dt ON (dt.FieldA =
a.Field4 and dt.FieldB = a.Field5)
WHERE
a.Field1 = 1 and a.Field2 = 2
GROUP BY
dt.SumFieldC
Kind
Regards,
Arno Brinkman
ABVisie
Arno Brinkman
ABVisie