Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Highest Values II

Re: Highest Values II

From: Dante <dnotari_at_my-deja.com>
Date: Fri, 28 May 1999 09:45:18 GMT
Message-ID: <7iloje$8h5$1@nnrp1.deja.com>


Try this one

SELECT *
  FROM mytable
 WHERE ROWNUM <= (SELECT MAX(ROWNUM)

                    FROM mytable
                    WHERE <the column which holds the values> > 0)
   AND <the column which holds the values> > 0 MINUS
SELECT <the column which holds the values>   FROM mytable
 WHERE ROWNUM <= (SELECT MAX(ROWNUM) - 50
                    FROM my_table
                   WHERE <the column which holds the values> > 0)
   AND <the column which holds the values> > 0  ORDER BY <the column which holds the values> DESC

or you use PL/SQL

Regards
Dante

In article <7ik69k$5ci$1_at_nnrp1.deja.com>,   rpereira_at_my-deja.com wrote:
> The following solution
>
> select *
> from (select *
> from mytable
> where <wherecondition>
> order by <the column which holds the values> desc)
> where rownum <= 50
>
> to find the 50's highest values from a number column in a table
> does not work in Oracle 7.3 (that I had)
>
> Please help me to find a way to do this
>
> Thanks.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Fri May 28 1999 - 04:45:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US