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

what is difference between NULL and ISNULL in SQL Server 2008?

997


How many types of local tables are there in sql server?

913


How can i Relate Tables in SSIS

1064


What is the importance of three tier architecture?

1066


Do you know what is similarity and difference between truncate and delete in sql?

990


What is Lock table in SQL?

1445


What is a linked server in sql server?

1050


List out what other servers you can use with ssrs?

137


What is subquery explain with example?

1038


How many clustered indexes there can be on table ?

1011


what is bit datatype and what's the information that can be stored inside a bit column? : Sql server database administration

965


How to get the number of affected rows?

984


Explain subquery and state its properties?

1013


Which database stores information about replication?

1033


What is normalization and what are the advantages of it?

956