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

Answer Posted / anil kumar karasi

1.
Select from <table name A>
where rowid > (select min(rowid) from <table name B>
where A.keyvalues=B.keyvalues);


2.
Delete from <table name A>
where rowid > (select min(rowid) from <table name B>
where A.keyvalues=B.keyvalues);

Is This Answer Correct ?    12 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we write ddl in trigger?

497


How are the exceptions handled in sql server programming?

611


How does using a separate hard drive for several database objects improves performance right away?

530


Explain what is dbcc?

595


Define constraints and give an example of their use?

565






What is the purpose of update statistics and scope_identity() function?

597


What is a unique key constraint?

533


What is indexing in sql server with example?

525


Thanks to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down?

527


What is the use of sign function?

560


How to provide values to user defined function parameters?

557


Write a SQL query in order to merge two different columns into single column?

625


How to store and query spatial data?

562


What is cursor in ms sql server?

564


How do I shrink an ldf file?

571