---
title: "How to find out second height salary from table in sql server?"  
description: "How to find out second height salary from table in sql server?"  
author: "Anonymous User"  
published: 2013-05-16  
updated: 2013-05-16  
canonical: https://www.mindstick.com/forum/896/how-to-find-out-second-height-salary-from-table-in-sql-server  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# How to find out second height salary from table in sql server?

Hi Expert!\
I'm new in database. My [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is that, how to find second height [salary from table](https://www.mindstick.com/interview/23307/how-to-find-second-highest-salary-from-table) in [sql server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server). I'm getting height salary as following...\
[CREATE DATABASE](https://www.mindstick.com/articles/1623/sfdc-create-an-app-and-database) DEMO\
USE DEMO\
[CREATE TABLE](https://www.mindstick.com/articles/443/how-to-create-table-in-sql-server) tblEmployee(EmpID INT [PRIMARY KEY](https://www.mindstick.com/blog/214/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](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Ben!\
You can try as following\
select MAX(Salary) from tblEmployee where Salary not in (select MAX(Salary) from tblEmployee)\
OR\
select MAX(Salary) from tblEmployee where Salary < (select MAX(Salary) from tblEmployee)


---

Original Source: https://www.mindstick.com/forum/896/how-to-find-out-second-height-salary-from-table-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
