Jump to content


Photo

Search through Duplicates


  • Please log in to reply
3 replies to this topic

#1 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 20 October 2006 - 09:13 PM

Is it possible to do a query to find out all the duplicates in a table?

I need to change a field to a unique and if I do that and it finds some duplicates is just stops at the first duplicate.

I need to get rid of the duplicates and there are roughly 176,000 records to go through :)



#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 22 October 2006 - 08:12 PM

Sure: SELECT yourField, COUNT(*) AS cnt FROM yourTable GROUP BY yourField HAVING cnt > 1
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 23 October 2006 - 03:49 PM

Cool, is there a way to delete the duplicate items without deleting all of it?

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 24 October 2006 - 02:40 AM

All of what?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users