| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Christian Mack | Date: | July 28 1999 5:41pm |
| Subject: | Re: getting rid of duplicates | ||
| View as plain text | |||
Joel Bremson wrote: > > Is there a simple way to remove exact duplicate rows from the database? > > Joel3 Hi Joel You have two choices: 1) If your row is less than 255 bytes wide and contains only up to 16 columns, then you can create a UNIQUE key over all columns with: ALTER TABLE tablename ADD UNIQUE (col1, col2, col3, ...); 2) Create a temporary table with the exact same column names and types as the table you want to be unique. Then insert the values from the original table into the temporary one with the IGNORE option. Finally DROP the original table and rename the temporary table to the original table name. Example: LOCK TABLES tempOrig WRITE, original WRITE; CREATE TABLE tempOrig (col1 INT, col2 VARCHAR(20),col3 TEXT,...); INSERT IGNORE INTO tempOrig SELECT * FROM original; DROP TABLE original; ALTER TABLE tempOrig RENAME original; UNLOCK TABLES; Tschau Christian
| Thread | ||
|---|---|---|
| • Restrict Access | toxalot | 27 Jul |
| • Restrict Access | sinisa | 27 Jul |
| • Re: Restrict Access | Thimble Smith | 27 Jul |
| • Re: Restrict Access | Paul DuBois | 27 Jul |
| • Re: Restrict Access | Martin Ramsch | 27 Jul |
| • Re: Restrict Access | Paul DuBois | 28 Jul |
| • Re: Restrict Access | Thimble Smith | 28 Jul |
| • Re: Restrict Access | sinisa | 28 Jul |
| • Re: Restrict Access | toxalot | 28 Jul |
| • On GET_LOCK () | sinisa | 28 Jul |
| • Re: On GET_LOCK () | Benjamin Pflugmann | 28 Jul |
| • Re: On GET_LOCK () | sinisa | 28 Jul |
| • Re: On GET_LOCK () | Paul DuBois | 28 Jul |
| • Re: On GET_LOCK () | Jim Faucette | 28 Jul |
| • Re: On GET_LOCK () | Paul DuBois | 28 Jul |
| • Re: On GET_LOCK () | Thimble Smith | 28 Jul |
| • Re: On GET_LOCK () | Gerald Clark | 28 Jul |
| • Re: On GET_LOCK () | Paul DuBois | 28 Jul |
| • Re: On GET_LOCK () | sinisa | 28 Jul |
| • Re: On GET_LOCK () | Paul DuBois | 28 Jul |
| • Re: On GET_LOCK () | Scott Hess | 28 Jul |
| • getting rid of duplicates | Joel Bremson | 28 Jul |
| • Re: getting rid of duplicates | Christian Mack | 28 Jul |
| • Re: On GET_LOCK () | sinisa | 29 Jul |
| • Re: On GET_LOCK () | Paul DuBois | 29 Jul |
| • Re: On GET_LOCK () | Scott Hess | 29 Jul |
| • Re: On GET_LOCK () | toxalot | 28 Jul |
| • Re: On GET_LOCK () | sinisa | 28 Jul |
| • Re: On GET_LOCK () | Benjamin Pflugmann | 29 Jul |
| • Re: On GET_LOCK () | Sasha Pachev | 29 Jul |
| • Re: On GET_LOCK () | Benjamin Pflugmann | 31 Jul |
| • Re: On GET_LOCK () | Thimble Smith | 29 Jul |
| • Re: On GET_LOCK () | Fraser MacKenzie | 29 Jul |
| • Re: On GET_LOCK () | Thimble Smith | 29 Jul |
| • Re: On GET_LOCK () | Fraser MacKenzie | 29 Jul |
| • Re: On GET_LOCK() | R. Mentink | 31 Jul |
