I want to calculate the points of each team in the PL
I have two tables
T1
---------------------
TEAM ID || TEAM NAME
---------------------
01 || Liverpool
02 || Man City
---------------------
while t2 for instance
----------------------------------------------------------------
MATCH ID || HOME TEAM || AWAY TEAM || HOME GOALS || AWAY GOALS|
-----------------------------------------------------------------
30 || Liverpool || Man City || 1 || 0
-----------------------------------------------------------------
To calculate the points now for each match if a team has num of goals greater than the other team he won and he got 3 Points and the loser got 0 points BUT if each one of them got the same num of goals they're even and each one of them got just 1 point.
the new table should be like this
-----------------------------------
Team ID || Team Name || Team Points
------------------------------------
01 || Liverpool || 28
02 || Man City || 22
------------------------------------
TEAM IDforAWAY TEAMandHOME TEAMinstead of the team names so it could be easily joined to table 1.