[PLUG] Delete duplicate entries in MySQL

Dtsig dtsig at hotmail.com
Mon Jul 29 23:01:58 UTC 2002


Hello Matt,

To follow up on my last message .. No .. probably the easiest way to
do this would be to create a new table with the same structure as you
currently have and create an index which is built of multiple columns
which when put together will define your 'unique' information.

Here is a little example from the DOC for mysql

CREATE TABLE test (
           id INT NOT NULL,
           last_name CHAR(30) NOT NULL,
           first_name CHAR(30) NOT NULL,
           PRIMARY KEY (id),
           INDEX name (last_name,first_name));


Then if you insert into your new table from your old table .. all rows
which do not maintain uniqueness will create and error.  Your new
table will have only unique rows.  Then use this new table so any
newly inserted or updated data will follow the rules.

Hope this helps
           
Sunday, July 28, 2002, 3:44:26 PM, you wrote:

MA> Does anyone know how to delete duplicate entries in a MySQL table?




-- 
Best regards,
 Dtsig                            mailto:dtsig at hotmail.com

Using 'The Bat' 1.61
Using 'OS' Windows 2000 Service Pack 2





More information about the PLUG mailing list