I was kindly given this code suggestion for getting the ranking of each person by score, is there a way of declaring the var without using a semicolon? I found one way of declaring from within the query but I couldn’t get it to work when using a sub-query like that below:
SET @rank := 0;
SELECT a.name,
a.AvScore,
@rank := @rank + 1
FROM (SELECT name,
Avg(score) AS AvScore
FROM results
GROUP BY name) a
ORDER BY a.AvScore
try it like that