I have a MySQL table that looks something like this:
GOALS
------------------------
PLAYER | GOALS
------------------------
001 | 30
002 | 25
003 | 25
004 | 20
I want to have a rank-based scoring system that gives half-points for ties. In the above example, it should look like this:
GOALS
-----------------------------------
PLAYER | GOALS | SCORE
-----------------------------------
001 | 30 | 4
002 | 25 | 2.5
003 | 25 | 2.5
004 | 20 | 1
In case of a three-way tie:
GOALS
-----------------------------------
PLAYER | GOALS | SCORE
-----------------------------------
001 | 30 | 5
002 | 25 | 3
003 | 25 | 3
004 | 25 | 3
005 | 20 | 1
How would something like this be done in mySQL?
Thanks!