Update中使用表别名
select中的表别名:
select * from TableA as ta
update中的表别名:
update ta set ta.key = 1 from TableA as ta
如何用表中一列值替换另一列的所有值
不同表列替换:
update ta set ta.key1 = tb.key2 from TableA as ta, TableB as tb where ta.key = tb.key
同一表列替换:
update ta set ta.key1 = tb.key2 from TableA as ta, TableA as tb where ta.key = tb.key