Re: Instead of SUM() I require MULTIPLY

  • From: Jonathan Gennick <jonathan@xxxxxxxxxxx>
  • To: Ethan Post <post.ethan@xxxxxxxxx>
  • Date: Fri, 9 Dec 2005 20:15:16 -0500

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@xxxxxxxxxxx



Friday, December 9, 2005, 5:13:09 PM, Ethan Post (post.ethan@xxxxxxxxx) 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

--
//www.freelists.org/webpage/oracle-l


Other related posts: