我有4张桌子:Team Player和玩家的出生地(我有城市和国家/地区)。
You need to retrieve the "Team" table twice, and join between them.
SELECT Game_Date,
Player.First_Name || ' ' || Player.Last_Name AS "PLAYER NAME",
UPPER(Team1.Team_Name) AS "HOME TEAM",
UPPER(Team2.Team_Name) AS "VISITING TEAM",
Team1.Team_City ||' '|| Team1.Team_Name as "TEAM",
Birth_Place1.Country
FROM Game
JOIN Team Team1 ON Game.Team_Home_ID = Team1.Team_ID
JOIN Team Team2 ON Game.Team_Visitor_ID = Team2.Team_ID
JOIN Player Player1 ON Player1.Team_ID = Team1.Team_ID
JOIN Player Player2 ON Player2.Team_ID = Team2.Team_ID
JOIN Birth_Place Birth_Place1 ON Birth_Place1.Birth_Place_ID = Player1.Birth_Place_ID
JOIN Birth_Place Birth_Place2 ON Birth_Place2.Birth_Place_ID = Player2.Birth_Place_ID
WHERE Birth_Place1.Country = Birth_Place2.Country
AND Season = '2015-2016'
AND Game_Date = '10-10-2015'
AND Birth_Place1.Country NOT IN ('CAN', 'USA')
ORDER BY Birth_Place1.Country;
Not sure if this is the exact correct request, but you get the idea: the trick is in the "Birth_Place1.Country = Birth_Place2.Country" WHERE clause.
Also rewrote the WHERE clause over Country since it looked like it only filtered out two countries.
You might consider reviewing your architecture a bit, especially the Birth_Place table: I guess knowing the player's country right in the Player table makes sense if you intend to use it as a filter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.