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
Difference between uniqe index and uniqe constraint?
How to get a list all databases on the sql server?
How to find the list of fixed hard drive and free space on server?
what is the information that can be stored inside a bit column? : Sql server database administration
Explain stored procedure?
Can an entity have two primary keys?
Why do you want to join software field as you have done your BE in Electronics?
Can another user execute your local temporary stored procedures?
What function does a database engine serve in the sql server?
Explain different types of lock modes in sql server 2000?
Explain different types of locks in sql server.
What are translations and its use? : sql server analysis services, ssas
What is the report builder?
What is the exact numeric data type in sql?
What is the significance of null value and why should we avoid permitting null values?