in reply to OT: routine for finding duplicate entries from a MySQL Table
You need some SQL here. The following query will show you which questions have a duplicate value.
SELECT questions, CONCAT(option_a, option_b, option_c, option_d) AS options, COUNT(*) AS howmany FROM yourtable GROUP BY questions, options HAVING howmany > 1
But if you simply want to delete the duplicates, then use ALTER TABLE to add a unique index to your table. Notice that you may need to qualify your columns with the number of characters to include. (See the appropriate manual page for details.)
ALTER IGNORE TABLE yourtable ADD UNIQUE KEY (questions, option_a, option_b, option_c, option_d) +;
This will also prevent duplicates to happen in the future.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: OT: routine for finding duplicate entries from a MySQL Table
by CountZero (Bishop) on Feb 04, 2004 at 13:53 UTC | |
by Caron (Friar) on Feb 04, 2004 at 17:18 UTC | |
by soon_j (Scribe) on Feb 04, 2004 at 22:46 UTC |