相关小知识点
作者:
内卷星球 | 来源:发表于
2018-03-29 16:20 被阅读0次
- Count(null) = 0
- Sum(null) = null
- null + 1 = null
- 根据得分进行排名,分数为0 不进行排名
SELECT
t.competition_id,
t.player_id,
(
SELECT
CASE WHEN t.score <= 0 THEN NULL ELSE COUNT(DISTINCT score) END # 当score小于等于0时,设定排名为null,否则根据where条件(t1.score > t.score)count不同的score值来获取排名
FROM
v_player_total_data t1
WHERE
t1.competition_id = t.competition_id
AND t1.score > t.score
) + 1 score
FROM
v_player_total_data t ORDER BY competition_id
本文标题:相关小知识点
本文链接:https://www.haomeiwen.com/subject/jqjfqftx.html
网友评论