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: To display 5 Largest values from table

Re: To display 5 Largest values from table

From: Greg Forestieri <gforestieri9_at_yahoo.com>
Date: 21 Mar 2003 06:38:07 -0800
Message-ID: <6a8cdd95.0303210638.475f4567@posting.google.com>


param_gcs_at_hotmail.com (SQL_SAVVY) wrote in message news:<8e3f64bc.0303210334.3f1812c_at_posting.google.com>...
> i want to display first 3 persons with largest salary

Is it 5 or 3? You might want to use dynamic sql as the users might want to vary the number.

A quickie would be...

select * from
(select *
 from salaries
 order by salary_amount desc)
where rownum <= 3

Good luck
Greg Received on Fri Mar 21 2003 - 08:38:07 CST

Original text of this message

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