<?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: Using a mysql update query to increment a field</title>
	<atom:link href="http://amystdesign.com/blog/mysql/update-query-increment-field/feed" rel="self" type="application/rss+xml" />
	<link>http://amystdesign.com/blog/mysql/update-query-increment-field</link>
	<description>Company Blog</description>
	<lastBuildDate>Mon, 26 Jul 2010 12:47:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Garry</title>
		<link>http://amystdesign.com/blog/mysql/update-query-increment-field/comment-page-1#comment-8</link>
		<dc:creator>Garry</dc:creator>
		<pubDate>Sat, 21 Mar 2009 00:33:39 +0000</pubDate>
		<guid isPermaLink="false">http://amystdesign.com/blog/?p=1#comment-8</guid>
		<description>Thanks Doug, the ORDER BY did it!

Regarding Emily&#039;s question: In my case the integer field relates to previous employments in the user&#039;s CV. If the user changes job, then all previous jobs need the integer to increment. Current Job becomes Most Recent Job, Most Recent Job becomes Most Recent - 1, and so on.</description>
		<content:encoded><![CDATA[<p>Thanks Doug, the ORDER BY did it!</p>
<p>Regarding Emily&#8217;s question: In my case the integer field relates to previous employments in the user&#8217;s CV. If the user changes job, then all previous jobs need the integer to increment. Current Job becomes Most Recent Job, Most Recent Job becomes Most Recent &#8211; 1, and so on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Linsmeyer</title>
		<link>http://amystdesign.com/blog/mysql/update-query-increment-field/comment-page-1#comment-7</link>
		<dc:creator>Doug Linsmeyer</dc:creator>
		<pubDate>Fri, 20 Mar 2009 23:26:02 +0000</pubDate>
		<guid isPermaLink="false">http://amystdesign.com/blog/?p=1#comment-7</guid>
		<description>It doesn’t have to be an auto-increment field to require a unique value (I think?). Just a primary key field, which are most often set to auto-increment for obvious reasons.</description>
		<content:encoded><![CDATA[<p>It doesn’t have to be an auto-increment field to require a unique value (I think?). Just a primary key field, which are most often set to auto-increment for obvious reasons.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emily</title>
		<link>http://amystdesign.com/blog/mysql/update-query-increment-field/comment-page-1#comment-5</link>
		<dc:creator>Emily</dc:creator>
		<pubDate>Fri, 20 Mar 2009 21:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://amystdesign.com/blog/?p=1#comment-5</guid>
		<description>Why would you be incrementing a unique integer (auto-increment?) field?</description>
		<content:encoded><![CDATA[<p>Why would you be incrementing a unique integer (auto-increment?) field?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Linsmeyer</title>
		<link>http://amystdesign.com/blog/mysql/update-query-increment-field/comment-page-1#comment-4</link>
		<dc:creator>Doug Linsmeyer</dc:creator>
		<pubDate>Mon, 16 Mar 2009 14:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://amystdesign.com/blog/?p=1#comment-4</guid>
		<description>The a field in one of your rows must already have the id it is trying to increment to, You could try to get around it by doing your UPDATE query in reverse ORDER... try adding something like:

ORDER BY id_field DESC that way it will be adding x to the highest number always and you should avoid cascading duplicates.</description>
		<content:encoded><![CDATA[<p>The a field in one of your rows must already have the id it is trying to increment to, You could try to get around it by doing your UPDATE query in reverse ORDER&#8230; try adding something like:</p>
<p>ORDER BY id_field DESC that way it will be adding x to the highest number always and you should avoid cascading duplicates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Garry</title>
		<link>http://amystdesign.com/blog/mysql/update-query-increment-field/comment-page-1#comment-3</link>
		<dc:creator>Garry</dc:creator>
		<pubDate>Mon, 16 Mar 2009 14:12:06 +0000</pubDate>
		<guid isPermaLink="false">http://amystdesign.com/blog/?p=1#comment-3</guid>
		<description>What can I do to make this work if the field is unique integer? As soon as the first one attempts to increment, I get a duplicate entry error.</description>
		<content:encoded><![CDATA[<p>What can I do to make this work if the field is unique integer? As soon as the first one attempts to increment, I get a duplicate entry error.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
