## 根据参照表table2的id顺序排序后生成rn排序号,然后根据关系字段column匹配更新排序号到table1的order_num。
update t1 set t1.order_num = t.rnfrom table1 t1join (select *,rn = ROW_NUMBER() OVER(ORDER BY id) from table2)t on t1.column = t.column