Re: Inconsistent behaviour with multi-table updates
Are you sure? I did not try it in 2005 but MSSQL 2000 sure does support a form of join syntax for updates, and, like MySQL, it does seem to update only once:
select * from t1
ID VAL
-----------
1 1
select * from t2
ID
--
1
1
update t1
set val = val + 1
from t1 a
inner join t2 b
on a.id = b.id
(1 row(s) affected)
select * from t1
ID VAL
---------------
1 2
So, if the row had been updated twice (the join yields 2 rows) the result would've been 3 (1 to begin with, + 1 and again + 1). But it is not: it's 2
Subject
Written By
Posted
Re: Inconsistent behaviour with multi-table updates
March 30, 2006 08:03AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.