2

How can i delete duplicate rows in my database name ( VB) included 255 tables using ALTER TABLE in PHP my admin ?

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331

1 Answers1

0

You can try to add unique index like this:

ALTER IGNORE TABLE tablename ADD UNIQUE INDEX idx_name (columnname1,columnname2 );

This query will drop all the duplicate rows from your table and it will also restrict users to add duplicate rows in future in the table.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • Error SQL query: ALTER IGNORE TABLE vb ADD UNIQUE INDEX idx_name (columnname1,columnname2 ) MySQL said: Documentation #1146 - La table 'vb.vb' n'existe pas – Mohammad Ahmad Al Ajouri Mar 26 '15 at 12:40
  • 1
    @MohammadAhmadAlAjouri:- 1. Please translate the error in English. 2. You need to mention the column name present in your table not columnname1 and columnname2. These are examples – Rahul Tripathi Mar 26 '15 at 12:42
  • *****@p3plcpnl0192 [~]$ mysqldump -u vbok -p --hex-blob --opt --default-character-set=latin1 vbok > new.sql Enter password: mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `post` at row: 63755 wwwowtjo@p3plcpnl0192 [~]$ – Mohammad Ahmad Al Ajouri Mar 26 '15 at 15:38