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 to return query output in html format? : Sql dba

1121


What is parameter substitution in sql?

1079


What is data abstraction in sql?

1064


List and explain the different types of join clauses supported in ansi-standard sql?

1400


What is a procedure in pl sql?

1286


How show all rows in sql?

1057


What is dml statement?

999


Mention what does plv msg allows you to do?

1161


What is use of trigger?

986


Why procedure is used in sql?

1083


What does select * from mean in sql?

3330


What is sql entity?

1170


What are sql indexes?

1046


How many types of keys are there in sql?

1084


What is a sql schema used for?

1153