Subject Re: AW: [firebird-support] Geometric average
Author Miroslav Penchev
On Mon, 6 Sep 2004 13:51:57 +0200, Steffen Heil <lists@...>
wrote:

> Hi
>
>> Is there any way to calcule a geometric average of a column using FB?
>> I mean (v0*v1*v2...vn)^1/n
>> Also, the total product of v0*v1*v2...vn is valid for me.
>
> Yes. Write a stored procedure.
>
> ...
> for select v from talbe into :v do begin
> v_total := :v_total * :v;
> v_count := :v_count + 1;
> end;
> v_result := :v_total / :v_count;
> ...

It needs function like 'Power' to calculate (...)^1/n;

--
Miroslav Penchev