update tb_order set UserID= a.ID
from tb_OrderUserInfo a inner join tb_order p on p.rownum=a.rownum
where DATEDIFF(M,p.InTime,GETDATE())<3
tb_order 表和tb_OrderUserInfo 表对应同一行号
tb_order 要取得tb_OrderUserInfo 的ID
update tb_order set UserID= a.ID
from tb_OrderUserInfo a inner join tb_order p on p.rownum=a.rownum
where DATEDIFF(M,p.InTime,GETDATE())<3
tb_order 表和tb_OrderUserInfo 表对应同一行号
tb_order 要取得tb_OrderUserInfo 的ID