Subject Re: question about joins
Author Paul R. Gardner
>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

My example was an extremely simplified statement. In reality it's much
longer, and needs to run without my having to divide by 3 or another
constant. Your solution here would require that I knew in advance the
number of records found in each table per ID which isn't feasable.

>I think subselects, as shown by Jose Ostos and Paul Mercea, would be
>normal way to solve things like this. May I ask you why that is not an
>alternative? Alternatives that I can think of are adding views or
>procedures that does the sum for you, but such solutions sounds
>to simple subselects.

It's hard to explain without pages of info (Which I can send if you'd
really want!). It actually is a stored procedure. I'm guessing this
isn't possible, but I was hoping there was some trick I was missing.

-- Paul

[Non-text portions of this message have been removed]