Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to retrieve the top 3 salaries of the table using rownum

Answer Posted / nilesh

You can also use a query like

select e.ename,e.sal from emp e where 3>(select count
(distinct(b.sal)) from emp b where b.sal>e.sal)

as explained by Kalyan Kumar in Answer 2 and for making
it parameterised u can replace 3 by &sal so that when it is
executed it will ask you a number
if you enter 3 it will give you best three salaries , if
you enter 4 it will give you best 4 salaries etc.

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you exit in sql?

1111


What is a pl/sql block?

1231


Can we rename a column in the output of sql query?

995


what is text? : Sql dba

1073


column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.

7351


how can we repair a mysql table? : Sql dba

981


What is form and report?

990


what are the disadvantages of mysql? : Sql dba

1149


How to select unique records from a table?

1059


What is difference between sql and excel?

1095


Can we use threading in pl/sql?

1041


What is sqlite used for?

1003


tell me about various levels of constraint. : Sql dba

1035


Explain the working of foreign key?

1068


what is union, minus and interact commands? : Sql dba

1186