leecode做数据库题178. 分数排名时遇到的疑问
# Write your MySQL query statement below
SELECT score, COUNT(a_score)+1
FROM
(
SELECT score,id,tb1.a_score,tb1.b_id,tb1.b_score
FROM Scores
LEFT JOIN
(SELECT DISTINCT a.score AS a_score,b.id AS b_id,b.score AS b_score
FROM Scores AS a,Scores AS b
WHERE a.score > b.score) AS tb1
ON tb1.b_id = Scores.id
) AS tb2
GROUP BY tb2.id
-- HAVING tb2.a_score != 'NULL'
ORDER BY score DESC
报错截图
尝试对字段重命名但报错了,网上也没找到类似的问题
SELECT score, COUNT(a_score)+1 AS rank
是因为类似count()+1这种不能进行字段重命名吗?