Bug #18532 An Aggregate Function that returns the product of all values, similar to SUM
Submitted: 27 Mar 2006 7:15 Modified: 17 Jun 2013 15:00
Reporter: Stephen Martindale Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version:All Future OS:Any (All)
Assigned to: Assigned Account CPU Architecture:Any

[27 Mar 2006 7:15] Stephen Martindale
Description:
With all these standard deviation and variance functions, one would expect a product function that returns the product of all the values selected. I have required this several times, mostly for pricing and costing, and never found it in MySql or Microsoft's SQL Server.

For example, consider a situation where there may be many markup factors applied to a product, all in a table. You could then "SELECT PRODUCT(`factor`) FROM `markups` WHERE..." and use the result to calculate your sales price.

How to repeat:
You could use SELECT SUM... to get the sum of all the values, but there is not apparent function to select the product of all the values.

Suggested fix:
Write a New Aggregate Function