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 is key attribute?
What is code near application topology?
How to fetch the next row from a cursor with a "fetch" statement?
What is precedence constraint?
Explain stored procedure?
How to convert a unicode strings to non-unicode strings?
What is difference between commit and rollback when used in transactions?
what is a transaction and what are acid properties? : Sql server database administration
Explain the disadvantages of cursors?
Do you know what are various aggregate functions that are available?
Why do we need normalization?
What happens if null values are involved in boolean operations?
how can you find out if the current user is a member of the specified microsoft® windows nt® group or microsoft sql server™ role? : Sql server administration
What is public role in sql server?
What are the different normalization forms?