<?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: Swap values in 2 rows SQL</title>
	<atom:link href="http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/</link>
	<description>Learn something share something</description>
	<lastBuildDate>Fri, 16 Jul 2010 20:06:22 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Maresa</title>
		<link>http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/comment-page-1/#comment-1440</link>
		<dc:creator>Maresa</dc:creator>
		<pubDate>Wed, 18 Nov 2009 05:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.microshell.com/?p=1990#comment-1440</guid>
		<description>Yes ... I realize that th method doesn&#039;t work when there id unique constraint. I&#039;ve tried many ways and I ended up having to do it in multiple statements. :-(</description>
		<content:encoded><![CDATA[<p>Yes &#8230; I realize that th method doesn&#8217;t work when there id unique constraint. I&#8217;ve tried many ways and I ended up having to do it in multiple statements. <img src='http://www.microshell.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IVO GELOV</title>
		<link>http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/comment-page-1/#comment-1409</link>
		<dc:creator>IVO GELOV</dc:creator>
		<pubDate>Mon, 16 Nov 2009 18:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.microshell.com/?p=1990#comment-1409</guid>
		<description>This method does not work when we have unique constraint/index on the given column :(</description>
		<content:encoded><![CDATA[<p>This method does not work when we have unique constraint/index on the given column <img src='http://www.microshell.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Regina</title>
		<link>http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/comment-page-1/#comment-976</link>
		<dc:creator>Regina</dc:creator>
		<pubDate>Thu, 15 Oct 2009 19:50:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.microshell.com/?p=1990#comment-976</guid>
		<description>Small little comment.  I think the PostgreSQL create table statement to more mirror the MySQL is

CREATE TABLE rules (
    rule_id serial PRIMARY KEY,
    rule_name  varchar(255)  NOT NULL,
    priority integer
) ;

the without oids can be left out since its the default behavior for newer versions.</description>
		<content:encoded><![CDATA[<p>Small little comment.  I think the PostgreSQL create table statement to more mirror the MySQL is</p>
<p>CREATE TABLE rules (<br />
    rule_id serial PRIMARY KEY,<br />
    rule_name  varchar(255)  NOT NULL,<br />
    priority integer<br />
) ;</p>
<p>the without oids can be left out since its the default behavior for newer versions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Onno Molenkamp</title>
		<link>http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/comment-page-1/#comment-952</link>
		<dc:creator>Onno Molenkamp</dc:creator>
		<pubDate>Mon, 12 Oct 2009 10:25:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.microshell.com/?p=1990#comment-952</guid>
		<description>It can be done with a few where-conditions less:

update rules
set priority = rule1.priority
from rules rule1
where rules.rule_id in (1, 4)
and rule1.rule_id + rules.rule_id = 1 + 4;</description>
		<content:encoded><![CDATA[<p>It can be done with a few where-conditions less:</p>
<p>update rules<br />
set priority = rule1.priority<br />
from rules rule1<br />
where rules.rule_id in (1, 4)<br />
and rule1.rule_id + rules.rule_id = 1 + 4;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maresa</title>
		<link>http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/comment-page-1/#comment-943</link>
		<dc:creator>Maresa</dc:creator>
		<pubDate>Sun, 11 Oct 2009 21:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.microshell.com/?p=1990#comment-943</guid>
		<description>The Cartesian product will result a combination of (1, 1), (1,4), (4,1), (4,4). The WHERE condition &quot;rules.rule_id  rule1.rule_id&quot; will get you (1, 4) and (4, 1). So the WHERE condition guarantees distinct, unless I&#039;m missing something.</description>
		<content:encoded><![CDATA[<p>The Cartesian product will result a combination of (1, 1), (1,4), (4,1), (4,4). The WHERE condition &#8220;rules.rule_id  rule1.rule_id&#8221; will get you (1, 4) and (4, 1). So the WHERE condition guarantees distinct, unless I&#8217;m missing something.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavel Golub</title>
		<link>http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/comment-page-1/#comment-941</link>
		<dc:creator>Pavel Golub</dc:creator>
		<pubDate>Sun, 11 Oct 2009 20:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.microshell.com/?p=1990#comment-941</guid>
		<description>For PostgreSQL you should use DISTINCT FROM I believe... in the last statement of course.</description>
		<content:encoded><![CDATA[<p>For PostgreSQL you should use DISTINCT FROM I believe&#8230; in the last statement of course.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
