<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Remove duplicate entries / rows a mySQL database table</title>
	<atom:link href="http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/</link>
	<description>A web, technology, programming and SEO blog by Justin Cook</description>
	<lastBuildDate>Mon, 15 Mar 2010 22:35:04 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: MichaelH on &#34;How to delete duplicate post_meta values in MySQL&#34;</title>
		<link>http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/comment-page-1/#comment-156493</link>
		<dc:creator>MichaelH on &#34;How to delete duplicate post_meta values in MySQL&#34;</dc:creator>
		<pubDate>Sun, 21 Feb 2010 17:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/#comment-156493</guid>
		<description>[...] http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/" rel="nofollow">http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rabs</title>
		<link>http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/comment-page-1/#comment-156466</link>
		<dc:creator>Rabs</dc:creator>
		<pubDate>Fri, 12 Feb 2010 13:19:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/#comment-156466</guid>
		<description>DO NOT USE THIS SOLUTION TO DE_DUP!!!!!

Guys, 
This is NOT a solution for de-duplicating data. Please, please, please take the following steps:
1) Backup your database! Absolutely IMPERATIVE!!!!!
2) Use a query along the lines of &quot;SELECT id, count(*) AS n FROM table GROUP BY id HAVING n&gt;1&quot; - this way you can INSERT the dupes into another table and see how many COUNTs of duplicates you have. There may be a reason in your code somewhere as to why you&#039;re getting the dupes.
3) Dependent on how many we are talking about... And by the way, I have been a DBA for 10+ years, having worked on databases with Terabytes of information stored in tables with millions of records - so have a bit of a clue as to what I&#039;m on about. One would always take a systematic or manual approach to record deletion. You look at the data you are going to delete prior to deletion. YOU NEVER GO DELETING DATA WILLIE NILLIE!!! BAD, BAD, BAD!!!!
4) Even after you have de-duped, keep a copy of the deleted records for a decent length of time. I&#039;m talking 7 years for an e-Commerce site. Storage is cheap and it&#039;s no hassle to keep it zipped up somewhere.

There is no hard and fast de-dupe strategy. You have to look at the data and decide what is best for you in the situation you are in. This is why people get paid to be DBA&#039;s!! Unfortunately, as I&#039;m sure IT Pro&#039;s all over will sympathise with, people with a little knowledge get themselves into a lot of trouble. The tools to do some wonderful things with these fantastic inventions called computers are freely available and very easy to use these days. Please, though, before you get yourself into a heap of trouble... Don&#039;t leave your brain at the door, take it in with you and use it before doing stuff you may regret.
Sorry for the rant! Just trying to keep folk out of the frying pan!!</description>
		<content:encoded><![CDATA[<p>DO NOT USE THIS SOLUTION TO DE_DUP!!!!!</p>
<p>Guys,<br />
This is NOT a solution for de-duplicating data. Please, please, please take the following steps:<br />
1) Backup your database! Absolutely IMPERATIVE!!!!!<br />
2) Use a query along the lines of &#034;SELECT id, count(*) AS n FROM table GROUP BY id HAVING n&gt;1&#034; &#8211; this way you can INSERT the dupes into another table and see how many COUNTs of duplicates you have. There may be a reason in your code somewhere as to why you&#039;re getting the dupes.<br />
3) Dependent on how many we are talking about&#8230; And by the way, I have been a DBA for 10+ years, having worked on databases with Terabytes of information stored in tables with millions of records &#8211; so have a bit of a clue as to what I&#039;m on about. One would always take a systematic or manual approach to record deletion. You look at the data you are going to delete prior to deletion. YOU NEVER GO DELETING DATA WILLIE NILLIE!!! BAD, BAD, BAD!!!!<br />
4) Even after you have de-duped, keep a copy of the deleted records for a decent length of time. I&#039;m talking 7 years for an e-Commerce site. Storage is cheap and it&#039;s no hassle to keep it zipped up somewhere.</p>
<p>There is no hard and fast de-dupe strategy. You have to look at the data and decide what is best for you in the situation you are in. This is why people get paid to be DBA&#039;s!! Unfortunately, as I&#039;m sure IT Pro&#039;s all over will sympathise with, people with a little knowledge get themselves into a lot of trouble. The tools to do some wonderful things with these fantastic inventions called computers are freely available and very easy to use these days. Please, though, before you get yourself into a heap of trouble&#8230; Don&#039;t leave your brain at the door, take it in with you and use it before doing stuff you may regret.<br />
Sorry for the rant! Just trying to keep folk out of the frying pan!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nadie</title>
		<link>http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/comment-page-1/#comment-156406</link>
		<dc:creator>nadie</dc:creator>
		<pubDate>Wed, 20 Jan 2010 04:32:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/#comment-156406</guid>
		<description>I didn&#039;t want to remove records but flag duplicates as inactive using one query. 

update 
contacts c,
(SELECT max(`contact_id`) id,`email`,count(*) qty FROM `contacts` where active=1 group by email) as tt
set active = 0
where 
	tt.qty &gt; 1
	and c.contact_id=tt.id</description>
		<content:encoded><![CDATA[<p>I didn&#039;t want to remove records but flag duplicates as inactive using one query. </p>
<p>update<br />
contacts c,<br />
(SELECT max(`contact_id`) id,`email`,count(*) qty FROM `contacts` where active=1 group by email) as tt<br />
set active = 0<br />
where<br />
	tt.qty &gt; 1<br />
	and c.contact_id=tt.id</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.418 seconds -->
