Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Marks_score列があるMarksテーブルがあり、Order BY Marks_score Descを使用して選択クエリを使用して Rank 列を追加したいと考えています。
RANK() SQL 関数の使い方がわからない
前もって感謝します!!!
これを使って:
RANK() OVER (ORDER BY TOTAL_CNT DESC DESC) AS ランク
select t1.*,RANK() OVER (ORDER BY t1.Marks_score DESC) AS Rank from Marks as t1
これを試して:
SELECT *,RANK() OVER (order by marks_score desc) as rnk FROM Marks
ここで他の例を見つけることができます
同じように、ROW_NUMBER()、DESNSE_RANK() 関数を使用できます。
この記事を読んで、両者の違いを見つけてください