LeetCode MySQL題目178. 分數排名

原題地址web /* 按S1表的Id分組,而後計算S2的Score比S1的組的Score大的元組的個數。 */ SELECT S1.Score AS Score, COUNT(DISTINCT S2.Score) AS Rank FROM Scores S1, Scores S2 WHERE S2.Score >= S1.Score GROUP BY S1.Id ORDER BY Rank;
相關文章
相關標籤/搜索