How do I delete all the duplicate records in a MySQL table without temp tables

前端 未结 9 1366
北恋
北恋 2020-11-27 03:46

I\'ve seen a number of variations on this but nothing quite matches what I\'m trying to accomplish.

I have a table, TableA, which contain the answers gi

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 04:14

    This doesn't use TEMP Tables, but real tables instead. If the problem is just about temp tables and not about table creation or dropping tables, this will work:

    SELECT DISTINCT * INTO TableA_Verify FROM TableA;
    
    DROP TABLE TableA;
    
    RENAME TABLE TableA_Verify TO TableA;
    

提交回复
热议问题