I need to access several tables, actually they are the same table but older versions, and get the max of subtracted score from both tables for each manager.
let’s say we tables r6 and r10 that have a field called scores.
I need to get the scores from the two tables and subtract the new score (from latest table) form the old one (in an older table) to get the managers score for between period.
let’s say table r6 has score = 1 for manager A, and table r10 has score = 5 for manager A. So for manager A the yield score is 5-1 = 4. Which is basically (r10.scores – r6.scores) which will be totalScore.
Now i need to get that totalScore (the score from 10-6) for all managers A-Z and also be able to find the highest one as well.
The question is, how to achieve that in mysql, if not possible, what do u suggest? I am using php btw.
Addition info:
Table’s Names:
1- ranking_gw6_260912 AS r6
2- ranking_gw10_201012 AS r10
Used Fields:
1- rx.manager_id
2- rx.scores
These fields exist in both tables.
n.b gw refers to game weeks of football matches, The website is for fantasy football and I am trying to get the winner of the contest who has the highest score from game week 6 to game week 10. Sadly, the database only stores the latest score overriding the on for the previous week. so I cannot get each week score and thus I am left with the overall score. Yet, we have a backup tables for each week that I will be using to get the between score.
since fields exists on both tables, use
INNER JOINor