SQLServer联表更新,update join
select * from ta s left join tb w on s.sd=w.SheetID
where s.d between '2024-08-12 13:59:00.000' and '2024-08-17 13:59:00.000' and s.w between 100 and 199
先查询确认数据范围再更新,以免误操作
update ta set OrderGld=w.OrderID,OrderSo=w.OrderSO
from ta s left join tb w on s.sd=w.SheetID
where s.d between '2024-08-12 13:59:00.000' and '2024-08-17 13:59:00.000' and s.w between 100 and 199