Monday, 14 July 2014

delete duplicate records in sql

select * from  employee
go
alter table employee add Id int Identity(1,1)
go
delete from  employee where ID not in
(
select min(id) as ID from employee group by EmployeeID,Salary

)
go
alter table employee drop column Id
go


select * from employee

No comments:

Post a Comment