Join 2 different sql queries

So I have to write a SQL query that outputs table that shows the name of the team, the number of games played points gained and average. So far this is what I wrote

SELECT `TeamName`, COUNT(`TeamName`)`Number Of Games Played`
FROM teamgames
GROUP BY `TeamName`
SELECT
    SUM(`Points`) `Number of points gained`,
    AVG(`Points`) ` Average points per game`,
    player.Team
FROM
    points
INNER JOIN player ON player.PlayerID = Points.PlayerID
GROUP BY
    player.Team

Is there a way I CAN JOIN these two queries so that my final output is something that looks like this

TEAM              NUMBER OF GAMES PLAYED       SUM     AVERAGE

Thanks



Read more here: https://stackoverflow.com/questions/64943098/join-2-different-sql-queries

Content Attribution

This content was originally published by Angela Star at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: