update tbl1 A set A.Status = 'S' where exists( select 1 from tbl2 H where A.no = H.no and A.Amount = H.Amount and A.Status = H.Status) -- update tbl2 H set H.status='S' where exists( select 1 from tbl1 A where H.no=A.no and H.amount=A.amout and H.status=A.status)
貌似不能update两个表。自己搞定了。如下,update tbl2 H set (H.Status) = (select ''S'' from tbl1 A where A.no = H.no and A.Amount = H.Amount and A.Status = H.Status ) BOBO12082119的方法应该也可行,不过exists这类语法的速度可以会有点慢,放分了。
写两个语句来更新。
update tbl1 A
set A.Status = 'S'
where exists(
select 1
from tbl2 H
where A.no = H.no
and A.Amount = H.Amount
and A.Status = H.Status)
--
update tbl2 H
set H.status='S'
where exists(
select 1
from tbl1 A
where H.no=A.no
and H.amount=A.amout
and H.status=A.status)
BOBO12082119的方法应该也可行,不过exists这类语法的速度可以会有点慢,放分了。