I found this Q&A here at stackOverflow while searching for a way to group rank data. The solutions work perfectly but how does one account for ties within the groups?
So far I know how to rank, but I don't know how to account for the ties in groups.
+--------------------------------------------+
| id | code | score | rank |
+--------------------------------------------+
| 2477 | 312 | 64 | 1 |
| 1865 | 312 | 63 | 2 |
| 2511 | 312 | 62 | 3 |
| 2890 | 312 | 61 | 4 |
| 1335 | 312 | 61 | 5 |
| 1504 | 312 | 60 | 6 |
| 1385 | 312 | 60 | 7 |
| 1984 | 312 | 59 | 8 |
| 2477 | 212 | 64 | 1 |
| 1865 | 212 | 63 | 2 |
| 2511 | 212 | 62 | 3 |
| 2890 | 212 | 61 | 4 |
| 1335 | 212 | 61 | 5 |
| 1504 | 212 | 60 | 6 |
| 1385 | 212 | 60 | 7 |
| 1984 | 212 | 59 | 8 |
What I need is this:
+--------------------------------------------+
| id | code | score | rank |
+--------------------------------------------+
| 2477 | 312 | 64 | 1 |
| 1865 | 312 | 63 | 2 |
| 2511 | 312 | 62 | 3 |
| 2890 | 312 | 61 | 4 |
| 1335 | 312 | 61 | 4 |
| 1504 | 312 | 60 | 5 |
| 1385 | 312 | 60 | 5 |
| 1984 | 312 | 59 | 6 |
| 2477 | 212 | 64 | 1 |
| 1865 | 212 | 63 | 2 |
| 2511 | 212 | 62 | 3 |
| 2890 | 212 | 61 | 4 |
| 1335 | 212 | 61 | 4 |
| 1504 | 212 | 60 | 5 |
| 1385 | 212 | 60 | 5 |
| 1984 | 212 | 59 | 6 |
is there a way to get the above results?