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...

I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000

Answer Posted / ashish

hey u can try This It defenately work...It for The nth
position mean for the N th node try it out.......



SELECT *
FROM emp A
WHERE (n-1) = (
SELECT COUNT(DISTINCT(B.salary))
FROM emp B
WHERE B.salary > A.salary)

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how would you improve etl (extract, transform, load) throughput?

987


Why do you need a sql server?

1055


What to perform pattern match with the like operator?

857


How to get a list of columns in a view using the "sp_columns" stored procedure?

1013


How to write an inner join with the where clause in ms sql server?

1053


How to fine-tune reports?

255


What is transact-sql language?

1031


Explain the microsoft sql server delete command?

977


What is the usage of the sign function?

1040


What is cte (common table expression)?

995


Does a server store data?

886


What is identity?

972


How to add the custom code in Report?

122


How to create a view on an existing table in ms sql server?

1081


Tell me what is the difference between locking and multi-versioning?

991