From: Ron <rmoeller@ladc.lockheed.com>
Subject: Re: median value
Date: 1996/12/12
Message-ID: <32B06EC9.7037@ladc.lockheed.com>#1/1
references: <32AF39B2.1759@infoseek.com>
content-type: text/plain; charset=us-ascii
organization: Lockheed Martin M & S, Sunnyvale, CA
mime-version: 1.0
newsgroups: comp.databases.oracle.tools
x-mailer: Mozilla 2.02 (WinNT; I)



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


