---
title: "Delete duplicate rows in SQL."  
description: "Delete duplicate rows in SQL."  
author: "Sunil Singh"  
published: 2017-11-24  
updated: 2017-11-25  
canonical: https://www.mindstick.com/forum/34367/delete-duplicate-rows-in-sql  
category: "mssql server"  
tags: ["database", "sql server"]  
reading_time: 1 minute  

---

# Delete duplicate rows in SQL.

I [am facing](https://answers.mindstick.com/qa/37099/if-i-am-facing-my-thoughts-while-meditating-am-i-meditating-wrong) a [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) in Sql. By [mistake](https://yourviews.mindstick.com/view/88393/ai-humanity-s-greatest-invention-or-final-mistake) I have inserted some [duplicate](https://www.mindstick.com/forum/160911/sql-query-to-find-duplicate-records-in-a-table-in-sql-server) record. I want to [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) all duplicate record ,

![Delete duplicate rows in SQL.](https://www.mindstick.com/mindstickforums/2e9dd661-706a-410a-8fe8-5c0edc45b4f2/images/814ea152-b7d3-494d-894d-b611920204ba.png)\

Can anyone tell me the query ,,,

\

## Replies

### Reply by Manish Kumar

Use this query

```
with SalaryCTE AS
(
select *, ROW_NUMBER() over (partition by id order by id) as rownumber from salary
)
DELETE from SalaryCTE where rownumber >1
```

It helps you.

\


---

Original Source: https://www.mindstick.com/forum/34367/delete-duplicate-rows-in-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
