How do I Handle Ties When Ranking Results in MySQL?
- by Laxmidi
Hi,
How does one handle ties when ranking results in a mysql query? I've simplified the table names and columns in this example, but it should illustrate my problem:
SET @rank=0;
SELECT student_names.students, @rank := @rank +1 AS rank, scores.grades
FROM student_names
LEFT JOIN scores ON student_names.students = scores.students
ORDER BY…