SQL Server添加序号列

来源:互联网 时间:1970-01-01

 select ROW_NUMBER() OVER(ORDER BY Convey_Fee desc) as z,rank() OVER(ORDER BY Convey_Fee desc) as z,DENSE_RANK() OVER(ORDER BY Convey_Fee desc) as z,NTILE(4) OVER(ORDER BY Convey_Fee desc) as z,(select sum(1) from Consign_D where Convey_Fee<=a.Convey_Fee) num,(select sum(1) from Consign_D where Convey_Fee<a.Convey_Fee) num1,Convey_Fee from Consign_D a order by Convey_Fee desc

 结果:


相关阅读:
Top