First time poster and really new to SQL

I use several in the following conditions to indicate that from one year to the next things fluctuate.

I have a data base going back several years.
Each Year has at least two seasons.
Each season has several leagues
Each league plays several matches per season.
Each Match can consist of 8 or 12 games depending on league
Each Match consist of 2 or 3 types of games (4 Games each).
Not every player will play in all types of games.

DB shows for each person the following:


Index Result, Player1_number, opp_Player1_number, team number, opp_team_num, week, Homeaway,Win,loss,game_code,season,rating
At this time there is nothing in rating.

For every game there are 2 entries; 1 showing player 1 vs player 2 win, and another showing player 2 V player 1 loss.

So what I want to do is the following:
run something within sql that will
a) look at year, then season, then Game_code, then Player1_number.
b) determine if there is a win or loss, then do a computation and adjust player 1 and player 2 in the rating column.
c) check to see if some people did not play in that particular game and assign their old rating value.
Move to next game, reapeat above process using new rating value.

So on and so for about 360 games - 11 season - 4 years.

Any thought?