Subject Re: [firebird-support] Re: question about joins
Author Michael Weissenbacher
> Nope, it depends on the number of matching records in the other
> table(s). With his example:
> ...
> To get the sum of the individual table, he would want sum(s.sales)/3 and
> sum(c.costs)/2.
Ooops, sorry, you are right. I guess my mind went the wrong way when I
thought that up. Pity that I can't withdraw yesterday's mail now without
a time machine :)

> select, sum(s.sales)/(select count(*) from coststable c2
> where =, sum(c.costs)/(select count(*) from salestable s2
> where =
> from maintable m
> left join salestable s on =
> left join coststable c on =
> where = 1
> group by
> Though I cannot think of any situation where this would be preferrable
> to a simple subselect.
Exactly, thanks for the clarification. Subselects or 2 seperate selects
would be the way to go then.