SQL Server添加序号列

来源:转载

 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

 结果:


分享给朋友:
您可能感兴趣的文章:
随机阅读: