Tilføj en anden variabel:
SET @prev_value = NULL;
SET @rank_count = 0;
SET @rank_increasing = 0;
SELECT score
, @rank_increasing := @rank__increasing + 1 AS row_num
, CASE
WHEN @prev_value = score
THEN @rank_count
WHEN @prev_value := score
THEN @rank_count := @rank_increasing
END AS rank
FROM ...