添加序号列(SQL Server)
SELECT ROW_NUMBER() OVER (ORDER BY 实际缴费金额 ) AS A, --序号 RANK() OVER (ORDER BY 实际缴费金额 ) AS B, --相同跳过从新计算 DENSE_RANK() OVER (ORDER BY 实际缴费金额 ) AS C, --相同不跳过从新计算 NTILE(4) OVER (ORDER BY 实际缴费金额 desc) AS D, --按给出的数字分组 实际缴费金额 FROM [dbo].[A流向费汇总] ORDER BY 实际缴费金额
学习地址 |
http://www.cnblogs.com/cailinaaa/archive/2006/10/20/534988.aspx |
http://blog.csdn.net/liu_1983/article/details/7269312 |