mysql - How to delete duplicate records but except one for Int? -
under table records mysql, have these:
select * dbo.online; +-------+ | id    | +-------+ | 10128 | | 10240 | |  6576 | |    32 | | 10240 | | 10128 | | 10128 | | 12352 | +-------+ 8 rows in set (0.00 sec)   how make to:
 select * dbo.online; +-------+ | id    | +-------+ | 10128 | | 10240 | |  6576 | |    32 | | 12352 | +-------+ 8 rows in set (0.00 sec)   in other words, want is, using delete command instead of select * dbo.online group id.. so, idea how?
copy data table distinct, steop eliminates duplicates
create table backup_online select distinct *  online;   clear source table
truncate table online   copy data source table without duplicates
   insert online    select *    backup_online      
Comments
Post a Comment