[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: RE: harmonic mean in SQL
From: "Jay Blanchard" <jblanchard () pocket ! com>
Date: 2010-10-22 11:20:01
Message-ID: 31454D514FF9A949B1FDFE294D5D1D8095DDE7 () ygex01wal ! onecall ! local
[Download RAW message or body]
[snip]
The mathematical way to add two "partial" harmonic means to generate new
harmonic mean is:
Let X1 , X2 be two harmonic means on different rollup rows, generated
using
n1 and n2 # of facts respectively.
The combined harmonic mean would be:
(n1 + n2)/( n1/x1 + n2/x2)
If you have experience with computing harmonic mean in SQL, please
share.
[/snip]
Unless I am misunderstanding your question the simplest method would be;
SELECT ((n1 + n2)/(n1/x1 + n2/x2)) AS "Harmonic Mean"
...without knowing the structure of the data. If X1 and X2 live on 2
different rows you could write a stored procedure to retrieve the
relevant data and produce an output.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic