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 / b.v.rajaram
delete top (select count(*)-(select count(distinct empname )
from Employee) from Employee)from Employee
where a in (select distinct a from Employee)
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How to write a query with a full outer join in ms sql server?
What happens if you add a new index to large table?
Explain what is the purpose of sql profiler in sql server?
How to delete all rows with truncate table statement in ms sql server?
What is clr ddl trigger?
What is policy based management (pbm)? : sql server database administration
What are the differences between substr and charindex in sql server.
What is the difference between DataRow.Delete() and DataRow.Remove()?
What is plan freezing?
How to connect a database with sql express.?
How do you handle datasets larger than 50 gb?
What is a collation in ms sql server?
What is a synonym for manipulation?
How to optimize stored procedures in sql server?
Do you know what is xpath?