Re: Median function in SQL

From: Steve Jelfs <s.jelfs_at_nospambtinternet.com>
Date: 1998/03/02
Message-ID: <34FAB6F4.3E03_at_nospambtinternet.com>#1/1


Martin Haltmayer wrote:
>
> I am not sure, but
>
> SELECT (MIN (revenue) + MAX (revenue)) * 0.5 ...
>
> might do the trick.
>
> Martin Haltmayer
>

I don't think so, in this group 1,2,10; 2 is the median but your algorhithm returns 5.5!

Sj

> Kevin Merritt wrote:
> >
> > Does anyone have any idea how to implement a MEDIAN function in Oracle? For
> > example, I would like to perform the following SQL SELECT statement:
> >
> > SELECT MEDIAN(revenue) FROM company_financials WHERE revenue > 1000000
> >
Received on Mon Mar 02 1998 - 00:00:00 CET

Original text of this message