Delete duplicate rows from a table without primary key by
using a single query
Table Employee
empname salary
A 200
B 300
A 200
C 400
D 500
D 500
Output should be
A 200
B 300
C 400
D 500
Answer Posted / honey
with myCTE as(
select row_number() over( partition by empname order by
empname) as myCount from Employee
)delete from myCTE where myCount >1
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Why use triggers?
What is the difference between system objects and user objects?
How do I find the query plan in sql server?
What is the difference between rank and dense_rank?
Explain for xml explicit mode?
What do you mean by tablesample?
Can sub report data source be different from that of the parent report?
What is meant by indexing?
What program is used to store the data source file?
Can you please explain the difference between primary keys and foreign keys?
What is server-level principal?
What are the steps you will take to improve the performance of a poor performing query?
Give the query of getting last two records from the table in SQL SERVER?
How many databases instances are there in sql server 2000?
How to find the list of fixed hard drive and free space on server?