update 表A set 字段=xx from 表A inner join 表b on a.M=b.M where b.字段=xx
update [aa] set I=0 from [aa] a inner join [bb] b on a.M=b.M where b.I=0 and a.R in (一个列)这样写,不更新为什么呀!
一列是a表的一组Id. a表只更新Id在这个列里,而且满足b表的条件的记录.
--应该是你的问题,你看下面我的测试,是正确的.declare @aa table(i int,m int,r int) insert into @aa select 1,1,1 union all select 2,2,2 union all select 3,3,3 union all select 4,4,4declare @bb table(i int,m int) insert into @bb select 1,1 union all select 0,3 union all select 3,33 union all select 0,2update @aa set I=0 from @aa a inner join @bb b on a.M=b.M where b.I=0 and a.R in (1,3)select * from @aa
from 表A inner join 表b on a.M=b.M
where b.字段=xx
from [aa] a inner join [bb] b on a.M=b.M
where b.I=0 and a.R in (一个列)这样写,不更新为什么呀!
insert into @aa
select 1,1,1
union all select 2,2,2
union all select 3,3,3
union all select 4,4,4declare @bb table(i int,m int)
insert into @bb
select 1,1
union all select 0,3
union all select 3,33
union all select 0,2update @aa set I=0
from @aa a inner join @bb b on a.M=b.M
where b.I=0 and a.R in (1,3)select * from @aa