How can I delete duplicate entries from tables in my database using Query Analyzer, as there are many duplicate entries in my tables, I want to delete them.
Thanks in advance,
Uday.Does this table contains any unique key or any other key field?|||Hi,
There is seperate id for each entries but duplicate entries have the same id number.
Thanks in advance,
Uday.|||One solution could be adding identity column to this and then deleting the non relevent data.|||You can move all the duplicate ones into a separate temp table using GROUP BY HAVING COUNT(*)>1
Then you delete them using the same clause can use a SELECT DISTINCT to copy them back from the temp table.
Of course if your table is small you can just copy the lot and do a SELECT DISTINCT back!
No comments:
Post a Comment