Bug #22965 Feature request: WEIGHTED_AVG

Submitted: 3 Oct 2006 23:15 Modified: 4 Oct 2006 12:33
Reporter: Jason Miele Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version: OS:
Assigned to: CPU Architecture:Any
Tags: Weighted Average

[3 Oct 2006 23:15] Jason Miele
Description:
I would like to see a 'group by' feature named:
WEIGHTED_AVG(x,y)

The feature would accept two column names such as 'weight' and 'value' and produce the following output:

WEIGHTED_AVG = weight1*value1 + weight2*value2 + weight3*value3...

How to repeat:
This is a feature request, see description.
[3 Oct 2006 23:27] Jason Miele
WEIGHTED_AVG = (weight1*value1 + weight2*value2 + weight3*value3 + ... + weightX*valueX) / X

X = rowcount
[3 Oct 2006 23:32] Jason Miele
Nevermind, I figured it out...
SUM(quantity*weight)/SUM(quantity)
Please close this feature request
thx
[4 Oct 2006 12:33] Valeriy Kravchuk
Closed as reporter solved the problem with already existing features.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.