Subject Re: [firebird-support] question about joins
Author Michael Weissenbacher
> My original hope was that I would return the results (1, 25.00, 14.00)
> but I instead get (1, 75.00, 28.00). The joins take place between all
> records including the costs/sales tables. Is there any way around this?
> For what I'm doing, I really cannot use any sub select statements, nor
> can I use two separate select statements. Is it possible to do this
> with just one?
For this case it would be possible to use something like:
select, sum(s.sales)/3 salessum, sum(c.costs)/3 costssum
from maintable m
left join salestable s on =
left join coststable c on =
where = 1
group by

I can't think of a better way to do it with a single statement. I guess
the performance would be bad with many records.