Subject | Re: question about joins |
---|---|
Author | Paul R. Gardner |
Post date | 2007-02-27T21:54:16Z |
>For this case it would be possible to use something like:My example was an extremely simplified statement. In reality it's much
>select m.id, sum(s.sales)/3 salessum, sum(c.costs)/3 costssum
>from maintable m
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 bethe
>normal way to solve things like this. May I ask you why that is not anstored
>alternative? Alternatives that I can think of are adding views or
>procedures that does the sum for you, but such solutions soundsinferior
>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]