Re: [SQL ] MSSQL2005 怎樣取得某行的排名名次
你的意思是這樣 ?
select * from
(select row_number() over(order by integral desc) as rownum
from igsns_listlog
where GameID = '101') v1
where v1.UID = '51e2c238-8be7-4043-9113-9ec500abc928'
※ 引述《jkly1846 (ajaxjsp)》之銘言:
: HI 各位好
: 假設我有一個以下的SQL
: SELECT ROW_NUMBER() OVER(ORDER BY [Integral] DESC) AS rownum
: FROM [IGSNS].[dbo].[IGSNS_ListLog]
: where GameID='101'
: AND UID='51e2c238-8be7-4043-9113-9ec500abc928'
: 這樣子查出來每次rownum都是1 可能是只用這一行UID來比較
: 但是實際上資料有很多行
: 我想知道的是這UID在排序後是第幾名
: 請問SQL該怎樣下比較好??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 116.197.7.80
討論串 (同標題文章)