<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Update statement using two or more tables fails"]]></title>
		<link>http://forums.enterprisedb.com/posts/list/7.page</link>
		<description><![CDATA[Latest messages posted in the topic "Update statement using two or more tables fails"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Update statement using two or more tables fails</title>
				<description><![CDATA[ create table t1 (c1 int, c2 int);<br /> create table t2 (c1 int, c2 int);<br /> <br /> update t1<br /> set c2 = t2.c2<br /> from t2<br /> where t2.c1 = t1.c1<br /> <br /> Result:<br /> <br /> SQLException: ERROR: Encountered "from" at line 1, column 26.<br /> Was expecting one of:<br />     &lt;EOF&gt;<br />     "WHERE" ...<br />     "!" ...<br />     ";" ...<br />     "," ...<br />     "::" ...<br />     "+" ...<br />     "-" ...<br />     "||" ...<br />     "*" ...<br />     "/" ...<br />     "MOD" ...<br />     "DIV" ...<br />     "%" ...<br />     "&" ...<br />     "|" ...<br />     "#" ...<br />     "&lt;&lt;" ...<br />     "&gt;&gt;" ...]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/5419.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/5419.page</link>
				<pubDate><![CDATA[Tue, 9 Dec 2008 16:55:17]]> GMT</pubDate>
				<author><![CDATA[ Don_N]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ Hi Don,<br /> <br /> You need to use syntax like this:<br /> <br /> update t1<br /> set c2 =<br /> (select t2.c2<br /> from t2<br /> where t2.c1 = t1.c1);<br /> <br /> Regards,<br /> <br /> Mason Sharp<br /> ]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/5422.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/5422.page</link>
				<pubDate><![CDATA[Wed, 10 Dec 2008 09:18:24]]> GMT</pubDate>
				<author><![CDATA[ Mason_S]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ Wouldn't that be slow when updating multiple columns which is my common update scenario, or are there optimizations to support this?]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/5424.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/5424.page</link>
				<pubDate><![CDATA[Wed, 10 Dec 2008 12:35:01]]> GMT</pubDate>
				<author><![CDATA[ Don_N]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ Hi Don,<br /> <br /> I have added multi-column correlated update as a new feature request in our tracking system. <br /> <br /> Regards,<br /> <br /> Mason]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/5427.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/5427.page</link>
				<pubDate><![CDATA[Thu, 11 Dec 2008 12:27:30]]> GMT</pubDate>
				<author><![CDATA[ Mason_S]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ Hi Mason,<br /> Your suggested workaround does work, but fails when a where clause is needed to reduce the rows to be updated. For example:<br /> <br /> <br /> update t1<br /> 	set c2 = (select t2.c2 from t2 where t2.c1 = t1.c1)<br /> where exists (select * from t2 where t2.c1 = t1.c1);<br /> <br /> Result:<br /> <br /> SQLException: ERROR: Failed To Get Results For ( SQL , NodeURL)  :  ( SELECT ( SELECT "t2"."c2" From  "t2" WHERE ("t2"."c1" = "TMPTT433_1"."c1")) as "EXPRESSION1", "c1" as "c1_old", "c2" as "c2_old" FROM "TMPTT433_1" ) eQS Node 13 has aborted execution, cause is: java.sql.SQLException : ERROR: column "c2" does not exist<br /> <br /> ]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/5438.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/5438.page</link>
				<pubDate><![CDATA[Fri, 12 Dec 2008 15:07:01]]> GMT</pubDate>
				<author><![CDATA[ Don_N]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ Hi Don,<br /> <br /> That does indeed look like a problem.<br /> <br /> We will investigate.<br /> <br /> Regards,<br /> <br /> Mason]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/5445.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/5445.page</link>
				<pubDate><![CDATA[Sun, 14 Dec 2008 20:34:36]]> GMT</pubDate>
				<author><![CDATA[ Mason_S]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ xtest=&gt; UPDATE T_JH_M_QUANGQU_DATE_201003 SET RING_NAME=<br /> xtest-&gt; (select b.SONGNAME from D_QUANGQU AS B where b.CONTENTID=RING_ID)<br /> xtest-&gt; ;<br /> ERROR:  Node 14 has aborted execution, cause is: java.sql.SQLException : [color=red]ERROR: more than one row returned by a subquery used as an expression[/color]xtest=&gt; UPDATE T_JH_M_QUANGQU_DATE_201003 SET RING_NAME=<br /> (select min(b.SONGNAME) from D_QUANGQU AS B where b.CONTENTID=RING_ID);<br /> [color=green]Cancel request sent<br /> Cancel request sent<br /> Cancel request sent<br /> Cancel request sent<br /> Cancel request sent[/color]<br /> <br /> <br /> i have two question:<br /> 1.when update statement using two tables ,  error "ERROR: more than one row returned by a subquery used as an expression" how can i do?<br /> 2. i can not ctrl_c to interrupt it ??<br /> <br /> ]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/9464.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/9464.page</link>
				<pubDate><![CDATA[Wed, 1 Dec 2010 04:21:59]]> GMT</pubDate>
				<author><![CDATA[ harry_zhang]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ xtest=&gt; UPDATE T_JH_M_QUANGQU_DATE_201003 SET RING_NAME=<br /> xtest-&gt; (select b.SONGNAME from D_QUANGQU AS B where b.CONTENTID=RING_ID)<br /> xtest-&gt; ;<br /> ERROR:  Node 14 has aborted execution, cause is: java.sql.SQLException : [color=red]ERROR: more than one row returned by a subquery used as an expression[/color]xtest=&gt; UPDATE T_JH_M_QUANGQU_DATE_201003 SET RING_NAME=<br /> (select min(b.SONGNAME) from D_QUANGQU AS B where b.CONTENTID=RING_ID);<br /> [color=green]Cancel request sent<br /> Cancel request sent<br /> Cancel request sent<br /> Cancel request sent<br /> Cancel request sent[/color]<br /> <br /> <br /> [color=blue]i have two question:<br /> 1.when update statement using two tables ,  error "ERROR: more than one row returned by a subquery used as an expression" how can i do?<br /> 2. i can not ctrl_c to interrupt it ??[/color]<br /> ]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/9465.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/9465.page</link>
				<pubDate><![CDATA[Wed, 1 Dec 2010 04:23:09]]> GMT</pubDate>
				<author><![CDATA[ harry_zhang]]></author>
			</item>
			<item>
				<title>Re:Update statement using two or more tables fails</title>
				<description><![CDATA[ Hi Harry,<br /> <br /> We will look into this when we have a chance. <br /> <br /> Yes, you should be able to cancel a query. If there still is a problem, you could cancel on the individual backends.<br /> <br /> Mason]]></description>
				<guid isPermaLink="true">http://forums.enterprisedb.com/posts/preList/1552/9485.page</guid>
				<link>http://forums.enterprisedb.com/posts/preList/1552/9485.page</link>
				<pubDate><![CDATA[Tue, 7 Dec 2010 04:00:56]]> GMT</pubDate>
				<author><![CDATA[ Mason_S]]></author>
			</item>
	</channel>
</rss>
