How to retrieve duplicate rows in a table?
How to delete the duplicate entries in a table?

Answer Posted / lince thomas

it is very simple,,below
------------------------
select * from(
select row_number() over(partition by empname order by
empname)as rno,empname,salary from Emp1Pay)T
where T.rno>1


delete from Emp1Pay where empid=
(select empid from(select row_number() over(partition by
empname order by empname)as rno,empid
from Emp1Pay )T where T.rno>1)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of sql server replication? : sql server replication

626


What are actions, how many types of actions are there, explain with example? : sql server analysis services, ssas

546


Can you get second highest salary from the table?

555


How do we synchronize On-Premise SQL server with SQL Azure?

100


Describe triggers features and limitations?

508






What stored by the tempdb ? : sql server database administration

570


How is a full-text index updated?

542


What is filter index?

519


between cast and convert which function would you prefer and why?

543


Is sql server free?

526


What is use of attribute hierarchy optimized state? : sql server analysis services, ssas

589


How does SSIS(Sql Server Integration Services) deffer from DTS(Data Transformation Services)?

601


What happens if ntwdblib.dll is missing on your machine?

639


If a table does not have a unique index, can a cursor be opened on it?

517


What is the maximum row of a size?

577