SELECT
NAM,SUM(no)No,
RANK() OVER (ORDER BY SUM(no) DESC) AS rank
FROM test
GROUP BY (nam)
ORDER BY rank