I have an online statistical application for a local softball league. 2 of the tables are set up as follows
[tt]
TABLE: TEAMS
ID NAME DIVISION_ID
-- -------- -----------
1 Team 1 1
2 Team 2 1
TABLE: SCHEDULE
GAME_ID TEAM1_ID TEAM_2ID DATE TIME
------- -------- -------- ------ -------
1 1 2 6/5/06 7:00 PM
[/tt]
How can you create a table join in an sql query of SCHEDULE so that team1_ID and team2_ID refers to the team name for both columns to avoid doing 2 additional queries to get the team names from their ids.
[tt]
TABLE: TEAMS
ID NAME DIVISION_ID
-- -------- -----------
1 Team 1 1
2 Team 2 1
TABLE: SCHEDULE
GAME_ID TEAM1_ID TEAM_2ID DATE TIME
------- -------- -------- ------ -------
1 1 2 6/5/06 7:00 PM
[/tt]
How can you create a table join in an sql query of SCHEDULE so that team1_ID and team2_ID refers to the team name for both columns to avoid doing 2 additional queries to get the team names from their ids.