Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Instead of SUM() I require MULTIPLY

Re: Instead of SUM() I require MULTIPLY

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Fri, 9 Dec 2005 20:15:16 -0500
Message-ID: <1564753058.20051209201516@gennick.com>


Hello Ethan,

You can sum the logarithms, and then raise the result to the power of e using the exp function. For example, try:

select exp(sum(ln(x))) from test;

It should give you the results you are after.

Best regards,

Jonathan Gennick --- Brighten the corner where you are http://Gennick.com * 906.387.1698 * mailto:jonathan@gennick.com

Friday, December 9, 2005, 5:13:09 PM, Ethan Post (post.ethan_at_gmail.com) wrote: EP> I just came up with a function I would like, but don't think exists.

EP> TABLE TEST (X NUMBER)
EP> =====================
EP> 2
EP> 2
EP> 4

EP> select sum(x) from test;

EP> will return 8...

EP> what I need is

EP> select multiply(x) from test;

EP> will return 16, because 2*2*4 is 16.

EP> Anyone ever seen a SQL aggregate function like this? I don't think it exists EP> but I hold out hope.

EP> - Ethan

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Dec 09 2005 - 19:15:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US