I have built a score tracking system for a local sports club (golf). There are two courses. Everything works currently, but they want the ability to create an overall ranking between the two courses based on their ranking at each course, not their average at each course. Ie, someone has a 60 average and a 70 average, which means the are in 1st at one course, and 3rd at the other. So their overall rank score would be a 4. If someone had second at one course and 1st at the other, their overall score would be a 3, so they should be in first place on the overall ranking.
Currently I have two tables, one ranks the first course by averages, the second table ranks the other course by averages. So in the database I'm not storing rank (as in 1st, 2nd, 3rd) but averages, 60, 63, 65 etc and then filtering the data by those numbers.
Any help is appreciated. Hopefully I wrote this out semi-clearly
tl:dr how can I return the rank of a number in column from database