I have 2 tables. Player and Team. Team = name, city. Player = playerID, team
Question: Number of players in each team and city
I'm finding number of player in city. For example;
SELECT COUNT(*),city
FROM Team t INNER JOIN Player p
ON t.name=p.team
GROUP BY city
Output;
City, number of player in city
A , 10
B , 5
C , 15
I'm finding number of player in team. For Example;
SELECT COUNT(*), team
FROM Player
GROUP BY team
Output;
Team, number of player in team
A1 , 5
A2 , 2
A3 , 3
B1 , 2
B2 , 3
C1 , 15
But I want to get these values in the same table.
Output;
City, Team, number of player in team, number of player in city
A , A1 , 5 , 10
A , A2 , 2 , 10
A , A3 , 3 , 10
B , B1 , 2 , 5
B , B2 , 3 , 5
C , C1 , 15 , 15
question from:
https://stackoverflow.com/questions/65944609/get-number-of-players-in-the-team-and-city