Users Pricing

forum

home / developersection / forums / how to find out second height salary from table in sql server?

How to find out second height salary from table in sql server?

Anonymous User 2328 16 May 2013
Hi Expert!

I'm new in database. My problem is that, how to find second height salary from table in sql server. I'm getting height salary as following...

CREATE DATABASE DEMO

USE DEMO

CREATE TABLE tblEmployee
(
EmpID INT PRIMARY KEY,
Salary MONEY
)

INSERT INTO tblEmployee(EmpID,Salary) VALUES (100,10000)
INSERT INTO tblEmployee(EmpID,Salary) VALUES (102,20000)
INSERT INTO tblEmployee(EmpID,Salary) VALUES (103,30000)
INSERT INTO tblEmployee(EmpID,Salary) VALUES (104,15000)
INSERT INTO tblEmployee(EmpID,Salary) VALUES (105,35000)

SELECT MAX(Salary) AS 'Height Salary ' FROM tblEmployee

It return '35000.00' that's max salary, but how to get second max salary '30000'!

Please help me!

Thanks in advance!

I am a content writter !


1 Answers