SELECT DISTINCT * INTO duplicate_table FROM original_table GROUP BY key_value HAVING COUNT(key_value) > 1
DELETE original_table WHERE key_value IN (SELECT key_value FROM duplicate_table)
INSERT original_table SELECT * FROM duplicate_table DROP TABLE duplicate_table
No comments:
Post a Comment