SqlServer根据表中ID加序号

正序列号
select ROW_NUMBER() over(order by Id) as xh,Id,Name,TelNumber,Zhijin from Users1

反序列号
select 序号=(select count(1) from Xuhao a where a.Id>=Xuhao.Id),* from Xuhao

原文地址:https://www.cnblogs.com/Dingcps/p/9353569.html