34,873
社区成员
发帖
与我相关
我的任务
分享

update bb
set yesno=1
from bb
inner join aa on substring(aa.TrainSerial,8,7)=bb.TrainSerial
and aa.TrainIdentification='H'
and bb.TrainSerial>0
and bb.yesno=0
--最好先select一下,没有问题再update
--select *
update b set b.yesno=1
from bb as b
inner join aa as a on SUBSTRING(a.TrainSerial,8,7)=b.TrainSerial and b.TrainSerial>0
and b.yesno=0
where a.TrainIdentification='H'