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
explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
What is the New in SQL server 2008?
What are the different types of Indexes available in SQL Server?
why would you call update statistics? : Sql server database administration
What is system stored procedures?
how you can deploy an ssrs report?
What are the types of normalization?
What are truncate options available in sql server? : sql server database administration
How to count rows with the count(*) function in ms sql server?
List down some advantages of sql stored procedure?
What is updatable resultset?
what are the different types of replication you can set up in sql server? : Sql server database administration
Ms sql server index?
What is nested transaction?
How many ways to create table-valued functions?