동일한 값이 있는 테이블에서 랭킹 구하기 (rank 함수)

SELECT rank() over (ORDER BY rs.score DESC, rs.ranking_reg_date asc ) as rank_no , rs.idx
, rs.player_id, rs.login_id,score, rs.clear_map, rs.ranking_reg_date
FROM (
SELECT Rank() over (Partition BY player_id ORDER BY score DESC, ranking_reg_date asc ) AS rank_top
, idx, player_id, login_id,score, clear_map, ranking_reg_date
FROM dbo.ranking where 1=1
) rs WHERE rank_top = 1
Previous
Next Post »