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
sql database suspect We have a sql database that is showing as suspect. How can we recover?
How secure is sql server database?
Do you know what are the restrictions that views have to follow?
What are different types of constraints?
What are differences in between sql server 2012 and sql server 2016?
What is the difference between set and select?
What is repeatable read?
How do I save a stored procedure in sql server?
What are the differences between decimal and float in ms sql server?
How do you send email on SQL Server?
Where sql server usernames and passwords are stored in a sql server?
Can you pass expressions to function parameters?
What does normalization do to data?
What is isnull() operator?
How to create a user name in a database?