Everyone can thank Harold Fuchs for contributing this one:

exp(sum(log(coalesce(*the field you want to multiply*,1)))

The coalesce() function is there to guard against trying to calculate the
logarithm of a null value and may be optional depending on your
circumstances.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

<Victor Pendelton in response to Fyodor wrote>
No there is not. Two options could be to either create an UDF or use a
programming language.

-----Original Message-----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/25/04 1:25 PM
Subject: is there a PRODUCT() or MULTIPLY() aggregate function?

Is there an aggregate function that multiplies column values just like
SUM()
adds them?



For instance, if "SELECT value FROM data" returns three values 2, 3, and
4,
then "SELECT PRODUCT(value) FROM data" would return 24, which is 2 * 3 *
4.



Thanks!



---
Fyodor Golos
Stockworm, Inc.
</Victor to Fyodor>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to