-2
這是目前正在獲取所有用戶排名的MySQL查詢。但我想獲取特定的用戶等級。查找用戶測試的排名MySQL
SELECT Percentage_of_Marks,mark,test_id,
1+(SELECT count(*) from user_test a
WHERE a.Percentage_of_Marks > b.Percentage_of_Marks) as RNK,
Percentage_of_Marks
FROM user_test b
ORDER BY b.Percentage_of_Marks DESC
我的查詢結果是。
如何找到特定爲test_id的RNK。
附加其中爲test_id = '叔044'(from子句和前爲了通過後) – scaisEdge
參見http://meta.stackoverflow.com/questions/333952/why-should-i-provide-an -mcve換什麼,似乎對我將要-A-極簡單的SQL查詢 – Strawberry