if 3 duplicate records in a table,i want to delete 2 duplicate
records by keeping 1 duplicate and 1 original as it is,how?

Answer Posted / amol maske

DELETE FROM tablename WHERE ROWID NOT IN(
SELECT MIN(ROWID)FROM tablename GROUP BY columnname);

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What can be used instead of trigger?

830


How you trouble shoot when any job fails

1695


What are indexes in sql?

823


What are the different types of triggers in SQL SERVER?

762


What is the security principal at the database level that represents your session?

737


How to get a list of columns in a view using the "sp_columns" stored procedure?

823


How you can find out if an index is useful to the optimizer?

680


How adventureworkslt tables are related?

714


What are the new features in SQL Server 2005 when compared to SQL Server 2000?

882


When we should use @@error?

731


Explain “@@rowcount” and “@@error” in sql server?

768


What do you mean by data manipulation language?

776


How to enter comments in transact-sql statements?

747


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?

732


Explain sql delete command?

815