zeerd's blog     Article     Search     About     Tags     Pebble     Feed

闲来生雅趣,无事乐逍遥。对窗相望雪,一盏茶香飘。

SQL将指定表排序并输出满足条件的记录是第几条

#SQL


用于获取名次等的查询功能。

Select @result=fieldx from(
     Select *, ROW_NUMBER() over (order by fieldy desc) as fieldx from table where xxx
    ) AS T
Where T.xx = xx