I'm wondering if someone can help me with a problem I've been trying to solve for almost a week now which concerns shared ranking (i.e. whilst I am trying to rank things in order of one field, if two or more entries share the same value then they receive the same ranking).
I have a MySQL database as follows:-
racedate | racetime | racecourse | horsename | forecast | rank | id
The racedate for the purposes of this will always be the same. The racetime and racecourse together identify the race in question.
forecast is the price given to each horse (this has already been entered at this stage) and this is what needs to have the shared ranking done on it to be stored in "rank".
id is just the unique index for each entry in the table.
The problem is further compounded by the fact that I wish to rank each race within the table seperately.
An example of what I am trying to do is given by this illustration:-
RACE - HORSE - FORECAST - RANK
Race 1 - Horse A - 8 - RANKING SHOULD BE 2
Race 1 - Horse B - 8 - RANKING SHOULD BE 2
Race 1 - Horse C - 2 - RANKING SHOULD BE 1
Race 2 - Horse D - 4 - RANKING SHOULD BE 1
Race 2 - Horse E - 5 - RANKING SHOULD BE 2
Any assistance would be greatly appreciated.