So far, I have written a select statements getting the names of teams and their average scores on home games and the average scores they conceded to the other team.
I have another one for the teams when they are away, where I selected the away teams and their average scores when they are away and the average they conceded.
How could I join these two tables from the select queries so I get one with the team name, average scored home, average conceded home, average conceded away, and average scored away?
Here is my code:
select home_team, avg(home_score_half + home_score_full) as avg_scored_home,
avg(away_score_half + away_score_full) as avg_conceded_home
from matches
group by home_team;
select away_team, avg(away_score_half + away_score_full) as avg_scored_away,
avg(home_score_half + home_score_full) as avg_conceded_away
from matches
group by away_team;
Any help would be appreciated. Thanks!