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 / samba shiva reddy . m
delclare @temp(empname varchar(50),sal int)
select * into @temp
FROM employee
GROUP BY empname, salary
HAVING count(*) > 1
delete from employee
select * into employee from @temp as temp
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What are the properties of the relational tables?
Why do we backup Active Directory ?
New concepts of sql server 2005 use in your project.
What is the difference between dataadapter and datareader?
What is cross join in sql server joins?
you notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it? : Sql server administration
What happens if ntwdblib.dll is missing on your machine?
How to convert a table data in XML format in sql server?
Define left outer join?
Detail about query optimizer?
What is ems sql management studio? : sql server management studio
What are data driven subscriptions?
How to make remote connection in database?
How will you monitor replication latency in transactional replication? : sql server replication
Is truncate a dml command?