Users Pricing

forum

Home Forums How to find out second height salary from table in sql server? – MindStick

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

Anonymous User 2418 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...


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!

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md