variance aggregate function incorrect? Reference Materials reg create aggregate

From: Joseph Syjuco <joseph(at)asti(dot)dost(dot)gov(dot)ph>
To: postgres <pgsql-sql(at)postgresql(dot)org>
Subject: variance aggregate function incorrect? Reference Materials reg create aggregate
Date: 2002-06-24 22:13:25
Message-ID: 1024956806.2590.22.camel@Askr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hi
i needed the variance function ... i dont know if i introduced the wrong
parameters or maybe this variance is not the variance that im looking
for but it doesnt provide the right results

variance=(nEx^2 - (Ex)^2)/(n(n-1))
my sql statement
select variance(answer) from tbl_answer (where answer is of type
integer)

because of this i need to create my own variance aggregate (unless
someone enlightens me on whats happening with the variance aggregate) so
i would like to know if theres anyone who knows a good create aggregate
tutorial (with samples) ... all i got from google so far is the
reference from ninthwonder.com
TIA

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-06-24 22:40:37 Re: Request for builtin function: Double_quote
Previous Message Stephan Szabo 2002-06-24 21:06:00 Re: Slow SELECT with distinct, in a TIMESTAMP type column