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
What are the purposes of floor and sign functions?
what is datawarehouse?
What is policy management?
What is inner join in sql server joins?
Why I am getting this error when renaming a database in ms sql server?
What is pivot and unpivot?
What are synonyms?
what is package and it uses and how can u call a package
List layers of abstraction microsoft architectured to provide relational db through cloud platform ?
What new data source types were added in ssrs 2014?
Can we use trigger new in before insert?
Do you know what is raid and what are different types of raid configurations? : SQL Server Architecture
What are functions in the sql server?
How to view existing indexes on an given table using sp_help?
How to defragment table indexes?