Update中使用表别名 select中的表别名: select * from TableA as ta update中的表别名: update ta 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…
--查询行号 select row_number()over(order by CHECKTIME )as RowNum,*from CHECKINOUT --更新id列为行号 update CHECKINOUT set id=t.rowId from (select CHECKTIME, ROW_NUMBER() over(Order by CHECKTIME) as rowId from CHECKINOUT ) as t where t.CHECKTIME = CHECKINOUT.CHE…