Re: Finding Duplicates and Deleteing
select column1,column2,column3, count(*) as numlines from table group by column1,column2,column3 having numlines > 1 That will find them,, you'll have to write some script or something to go through the results and remove the duplicates, I'm not sure if a query that will do both at once. Linsen Limsico wrote: > > Does anyone know how to find duplicates in a table and deleting them. I can't figure >out how to structure the query. > > Linsen - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Finding Duplicates and Deleteing
Depending upon the function of the table, you might consider designing your table such that duplicates aren't possible (e.g. putting a UNIQUE index on a column or set of columns). Other than that, try dumping your table, removing the rows you don't want, and reloading the table. -Tilghman -- "There cannot be a crisis today. My schedule is already full." --Henry Kissinger > -Original Message- > From: Linsen Limsico [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 08, 2001 12:09 > > Does anyone know how to find duplicates in a table and > deleting them. I can't figure out how to structure the query. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Finding Duplicates and Deleteing
On Thu, 8 Feb 2001, Linsen Limsico wrote: > Does anyone know how to find duplicates in a table and deleting them. I can't figure >out how to structure the query. > > Linsen > Hello, Being new to this I don't know the coding however I would look at making another table and then use the UNIQUE command to place these unique (not duplicated) entires into the table. Regards Peter [EMAIL PROTECTED] -- Blessings are upon the head of the just: but violence covers the mouth of the wicked. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php