On Thu, Apr 10, 2008 at 4:36 PM, Osvaldo Rosario Kussama
<osvaldo(dot)kussama(at)gmail(dot)com> wrote:
>
> Try:
>
> SELECT count(*) AS frequency, score,
> count((SELECT * FROM scoretable st2 WHERE st2.score <= st1.score)) AS
> runningtotal
> FROM scoretable st1
> GROUP BY score
> ORDER BY score
>
> Osvaldo
>
Thankyou Osvaldo- that worked!
Final version:
SELECT count(*) AS frequency, score,
((((SELECT count(uid) FROM scoretable st2 WHERE st2.score <=
st1.score) - count(*)) + (count(*)/2))::float/(select
count(*) from scoretable))
FROM scoretable st1
GROUP BY score
ORDER BY score
I think that's a percentile rank now.
Cheers
Will