<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TechRawr &#187; query</title>
	<atom:link href="http://www.techrawr.com/tag/query/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techrawr.com</link>
	<description></description>
	<lastBuildDate>Sat, 26 Feb 2011 18:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Delete Duplicate Rows/Records in MySQL Table</title>
		<link>http://www.techrawr.com/2010/03/22/delete-duplicate-rows-mysql-table/</link>
		<comments>http://www.techrawr.com/2010/03/22/delete-duplicate-rows-mysql-table/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 08:45:14 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Database Servers]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://www.techrawr.com/?p=133</guid>
		<description><![CDATA[Most articles on removing duplicate rows from a MySQL table involve 3 steps, but the following query is what I use for purging dupe records in one simple query. DELETE FROM `myTable` WHERE id NOT IN (SELECT t1.id FROM (SELECT id, groupByColumn FROM `myTable` ORDER BY id DESC) as t1 GROUP BY t1.groupByColumn) - &#8220;myTable&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Most articles on removing duplicate rows from a MySQL table involve 3 steps, but the following query is what I use for purging dupe records in one simple query. </p>
<p><em>DELETE FROM `myTable` WHERE id NOT IN (SELECT t1.id FROM (SELECT id, groupByColumn FROM `myTable` ORDER BY id DESC) as t1 GROUP BY t1.groupByColumn)</em></p>
<p>- &#8220;myTable&#8221; is the name of the table with duplicate rows<br />
- &#8220;id&#8221; is the name of the primary key identifier in &#8220;myTable&#8221;<br />
- &#8220;groupByColumn&#8221; is the name of the column used to differentiate records as duplicates</p>
<p>Example: Table of Videos with the duplicate match being made on the &#8220;title&#8221; field.</p>
<p>DELETE FROM `videos` WHERE id NOT IN (SELECT t1.id FROM (SELECT id, title FROM `videos` ORDER BY id DESC) as t1 GROUP BY t1.title)</p>
<p>It&#8217;s a good SQL query to save or bookmark for those times when you need do some maintenance or cleanup during development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techrawr.com/2010/03/22/delete-duplicate-rows-mysql-table/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

