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

Mention the differences between local and global temporary tables.

1110


Explain difference between cross join and full outer join?

1065


What is the difference between Stored Procedures and triggers?

1133


What is 2nf example?

1052


How is SQL Azure different than SQL server?

225


What is difference between equi join and inner join?

1038


Define the one-to-one relationship while designing tables.

939


What is a system database and what is a user database?

1138


What is the recovery model? List the types of recovery model available in sql server?

944


Explain collation?

1100


What is a partition function in sql server?

1216


What is star, snowflake and star flake schema? : sql server analysis services, ssas

1228


What are the different types of subquery?

1200


How can you ensure that the database and sql server based application perform well?

1123


Is it possible to replicate data from sql server to oracle? : sql server replication

1140