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 do you know about system database? : SQL Server Architecture
Give some Scenario for Non Clusterd index? Can we write system defined functions in side The Function? Wat is the Unique Datatype?
What is the difference between for trigger and after trigger?
Define a cross join?
what's sql server? : Sql server database administration
What is statement level trigger?
Explain “not null constraint” in sql server?
Should you normalize audio?
What is microsoft sql server?
What are the reporting services components?
Explain database normalization?
Explain about extended stored procedure?
what are the different types of SSRS reports?
How adventureworkslt tables are related?
What is database replication?