<?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>Danny-T.co.uk &#187; MySQL</title>
	<atom:link href="http://danny-t.co.uk/index.php/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://danny-t.co.uk</link>
	<description>RIA Fanatic, ramblings on Flex, Flash, Silverlight, UX, .net</description>
	<lastBuildDate>Tue, 04 May 2010 09:51:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to increment a field in mysql</title>
		<link>http://danny-t.co.uk/index.php/2007/09/26/how-to-increment-a-field-in-mysql/</link>
		<comments>http://danny-t.co.uk/index.php/2007/09/26/how-to-increment-a-field-in-mysql/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 07:29:00 +0000</pubDate>
		<dc:creator>DannyT</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://danny-t.co.uk/index.php/2007/09/26/how-to-increment-a-field-in-mysql/</guid>
		<description><![CDATA[Nothing much to see here, just something I&#8217;m always forgetting the syntax for as I am often switching between SQL Server, MySQL and Oracle.
I needed to implement an incrementing numeric field for a &#8220;reportOrder&#8221; field, couldn&#8217;t rely on the primary key because I will later be adding the facility to re-order the table based on [...]]]></description>
			<content:encoded><![CDATA[<p>Nothing much to see here, just something I&#8217;m always forgetting the syntax for as I am often switching between SQL Server, MySQL and Oracle.</p>
<p>I needed to implement an incrementing numeric field for a &#8220;reportOrder&#8221; field, couldn&#8217;t rely on the primary key because I will later be adding the facility to re-order the table based on this field.</p>
<p><code><br />
SET @pos=0;<br />
INSERT INTO myNewTable(someField, reportOrder)<br />
SELECT fieldName, @pos:=@pos+1<br />
FROM myOldTable<br />
ORDER BY reportOrder;<br />
</code></p>
<p>All i&#8217;m doing is assigning the incremented variable value and at the same time reading it in the query. Like I said, nothing major just something I seem to need regularly and couldn&#8217;t find a rownum (oracle) equivilent for MySql</p>
]]></content:encoded>
			<wfw:commentRss>http://danny-t.co.uk/index.php/2007/09/26/how-to-increment-a-field-in-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
