I got my query to work , but as always, I'm looking for any and all advice on how to make it work better. And I'm not exactly clear on why I had to reference the tables in two different ways to get it to work....
I do know I can select fields instead of *, but other than that, do you see anything?
Table.schedules2 (it's called 2 because I wanted to keep the original in tact for testing)
GameID | GameDate | GameTime | GameField | AwayTeamID | AwayTeamScore | HomeTeamID | HomeTeamScore | Rainout
Table.teams
TeamID | DivisionID | Color | Manager | Win | Loss | Tie | WinPercentage
Table.divisions
DivisionID | DivisionName | AgeLower | AgeUpper
Query:
Code: Select all
<?php
SELECT * FROM schedules2 s, teams t1, teams t2, division d1, division d2
WHERE s.AwayTeamID = t1.TeamID
AND s.HomeTeamID = t2.TeamID
AND t1.DivisionID = d1.DivisionID
AND t2.DivisionID = d2.DivisionID
ORDER BY GameID
?>