in reply to Re: Re: OT: routine for finding duplicate entries from a MySQL Table
in thread OT: routine for finding duplicate entries from a MySQL Table
Well, the problem is that the OP wasn't very clear about what is a duplicate record. He mentioned an ID, but it isn't in the table description, so I assumed that a primary key existed, apart the columns that were mentioned.
Anyway, if the problem is (more trivially) to find out if several records have the same "questions" column, then it's even simpler:
SELECT questions, COUNT(*) AS howmany FROM yourtable GROUP BY questions HAVING howmany > 1
To remove such duplicates, on the same vein:
ALTER IGNORE TABLE yourtable ADD UNIQUE KEY (questions)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: OT: routine for finding duplicate entries from a MySQL Table
by soon_j (Scribe) on Feb 04, 2004 at 22:46 UTC |