您的位置:首页 > 数据库

sql server 2005 中的dense_rank()函数的应用

2007-04-02 16:31 531 查看
sql server 2005 排名提供dense_rank() 函数.实现起来非常简单.

示例如下:


declare @t table(place int,score int)


insert into @t select 11,10


union all select 3,10


union all select 2,20


union all select 2,30




select dense_rank()over(order by score ) as id,score from @t






/**//*


id score


-------------------- -----------


1 10


1 10


2 20


3 30




(4 行受影响)




*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐