NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Need to delete duplicate entries in mysql

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 10-08-2009, 08:55 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
dubya's Avatar
Join Date: Dec 2007
Posts: 241
dubya is a jewel in the roughdubya is a jewel in the roughdubya is a jewel in the rough
 




Need to delete duplicate entries in mysql


I have a database of over 600,000 business listings, and there are probably 100,000 duplicates in there.

So, I'm asking how to delete the duplicates efficiently. I made a table with all of the listing names that have duplicates. I need to somehow check all the names against the 600,000 listings and delete the duplicates.

The duplicate listings have all the same information, just a different ID in the table.

Any help is appreciated,

Thanks,
Dave
dubya is offline   Reply With Quote
Old 10-08-2009, 12:47 PM   #2 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,963
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
You could use SELECT DISTINCT (without the ID field)
so you won't get dupes
then INSERT the recordset into a fresh table, same structure as original table, the ID will be autogenerated.
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline   Reply With Quote
Old 10-08-2009, 01:03 PM   #3 (permalink)
Senior Member
 
Brujah's Avatar
Join Date: Apr 2006
Posts: 1,478
Brujah is a splendid one to beholdBrujah is a splendid one to beholdBrujah is a splendid one to beholdBrujah is a splendid one to beholdBrujah is a splendid one to beholdBrujah is a splendid one to beholdBrujah is a splendid one to behold
 


Animal Cruelty Diabetes Cancer Protect Our Planet Animal Rescue Save a Life Special Olympics Child Abuse Animal Cruelty Cancer Myanmar Relief Baby Health Wildlife Child Abuse Child Abuse Save a Life Save a Life Cystic Fibrosis Cystic Fibrosis Child Abuse Child Abuse Save a Life Cystic Fibrosis Cancer Save a Life Baby Health Cancer Survivorship
If this query works
SELECT * FROM table1,table1 as vtable
WHERE vtable.id > table1.id
AND vtable.fieldname = table1.fieldname

then this should remove the duplicates
DELETE FROM table1
USING table1,table1 AS vtable
WHERE vtable.id > table1.id AND table1.fieldname = vtable.fieldname

re: Mysql remove duplicate data or rows with DISTINCT
__________________
Free Keyword Popularity, CPC, etc... Namejet, Snapnames, GoDaddy Lists
Offers valid for 24 hours.
Now Available: Rented.com
Brujah is offline   Reply With Quote
Old 10-09-2009, 08:18 AM THREAD STARTER               #4 (permalink)
NamePros Regular
 
dubya's Avatar
Join Date: Dec 2007
Posts: 241
dubya is a jewel in the roughdubya is a jewel in the roughdubya is a jewel in the rough
 




Thanks, I've since found a solution to my problem.
dubya is offline   Reply With Quote
Old 11-04-2009, 02:35 AM   #5 (permalink)
New Member
Join Date: Nov 2009
Posts: 3
timstyris is an unknown quantity at this point
 



Hi..
Thanks for sharing the information...its really good for me... also i have read the solution...
__________________
dsi r4
timstyris is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:31 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger