---
title: "How can get alternate highest salary or any record in a table in SQL Server ?"  
description: "How can get alternate highest salary or any record in a table in SQL Server ?"  
author: "Anonymous User"  
published: 2018-08-02  
updated: 2018-08-06  
canonical: https://www.mindstick.com/forum/34652/how-can-get-alternate-highest-salary-or-any-record-in-a-table-in-sql-server  
category: "mssql server"  
tags: ["sql server", "database table"]  
reading_time: 1 minute  

---

# How can get alternate highest salary or any record in a table in SQL Server ?

Get alternate [records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records) in a [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) like as

\

| [Name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide) | RollNo | Marks |
| --- | --- | --- |
| A | 1 | 40 |
| B | 2 | 50 |
| C | 3 | 55 |
| D | 4 | 48 |
| E | 6 | 66 |
| \ | \ | \ \ |

how can get 2nd, 4th, and 6th position of marks ?

## Replies

### Reply by Koi Ken

Post is removed by the Admin.

### Reply by Anonymous User

USE **DENSE_RANK** FUNCTION for this operation.

MSSQL DENSE_RANK FUNCTION SYNTAX\

```
DENSE_RANK ( ) OVER ( [ <partition_by_clause> ] <order_by_clause> )
```


---

Original Source: https://www.mindstick.com/forum/34652/how-can-get-alternate-highest-salary-or-any-record-in-a-table-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
