Re: median value

From: Ron <rmoeller_at_ladc.lockheed.com>
Date: 1996/12/12
Message-ID: <32B06EC9.7037_at_ladc.lockheed.com>#1/1


Lisa Kilroy wrote:
>
> I need to pull the median value out of a table for a particular field.
>
> The median value is the middle record. So if I had 10 records sorted
> in I would want the value is record 5. I can't just go get that rownum
> because the records are not loaded in order and Oracle does not
> allow the order by to be used in create table or view.
>
> Thanks, Lisa

Good question. Sorry I can't be much help.

The best I came up with is a histogram

select trunc(x), count(y)
from table_name
group by trunc(x)

Ron Received on Thu Dec 12 1996 - 00:00:00 CET

Original text of this message