IT学习联盟

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
IT学习联盟 门户 文章 数据库 查看内容

SQL Server添加序号列

2012-8-18 05:30| 发布者: admin| 查看: 422| 评论: 0

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
 结果:  www.2cto.com  
 

 
Archiver|IT学习联盟| 网站地图

Powered by Discuz! X2.5© 2001-2010 世界学习室 大伟制作

GMT+8, 2018-2-25 05:42 , Processed in 0.082412 second(s), 12 queries .