Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Highest values of a table
To get values that are above 80% of the highest value
SELECT * FROM table
WHERE column > (SELECT (MAX(column) * 0.8) FROM table)
or to get those values in the top 20% of the table.
SELECT * FROM table
WHERE column >(SELECT MAX(column) - (MAX(column)-MIN(column))*.8 FROM table)
Steve Harrison
Kevin A Lewis wrote:
> SELECT MAX(column) FROM table;
>
> or
>
> SELECT MIN(column) FROM table;
>
> --
> Kevin A Lewis (BOCM PAULS LTD) - Animal Feed Manufacturer - Ipswich United
> Kingdom)
> <Kevin_A_Lewis_at_Hotmail.com>
>
> The views expressed herein by the author of this document
> are not necessarily those of BOCM PAULS Ltd.
> Mark van Dijk <markvandijk_at_hotmail.com> wrote in message
> news:f7niIWj1$GA.357_at_asd24-aux-005.tis.telfort.net...
> > Hi,
> >
> > I hope someone can help me out. I have the following question:
> > How can I select the say 20% highest (or lowest) values from a table by
SQL
> > or PL/SQL?
> >
> > Thanks,
> >
> > Mark
> >
> >
Received on Thu Jun 15 2000 - 00:00:00 CDT
![]() |
![]() |