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

What is rename in sql?

915


Is crud a cuss word?

971


What are different types of statements supported by sql?

1095


What is the difference between the implicit and explicit cursors?

990


what tools available for managing mysql server? : Sql dba

1002


What are all the different types of indexes?

1090


What is before trigger?

943


What is procedure in pl sql?

976


Can we connect to postgresql using sql developer?

932


What are the two characteristics of a primary key?

926


why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba

1040


What is the use of double ampersand (&&) in sql queries? Give an example

1076


What does where 1 1 mean in sql?

976


What are the different dml commands in sql?

1082


What are views in sql?

925