MSSQL row_number简单使用语法

MSSQL row_number简单使用语法

select * from (

select row_number() over(partition by threadid order by date desc) r,threadid,username

from blogs  ) tppp

where tppp.r=1

tppp.r=1可以找出排重后按排序规则排名第一的数据。
posted @ 2015-11-27 15:26  Mr. Hu  阅读(585)  评论(0编辑  收藏  举报
Map