[thelist] mySQL Query help

Anthony Baratta Anthony at Baratta.com
Thu Jun 10 17:20:32 CDT 2004


At 02:29 PM 6/10/2004, Tom Dell'Aringa wrote:
>Hi, need help with a query. I have two tables: "games" and "team". In
>games there is are two fields that are team IDs. I want to get the
>team NAME from the team table using the two stored IDs in games
>(foreign keys). I've not done queries in a long time and I'm really
>rusty so i cannot remember how to do it.

Select tblTeamA.TeamName as TeamAName, tblTeamB.TeamName as TeamBName
 From tblGames
join tblTeamNames as tblTeamA on tblTeamNames.TeamID = tblGames.TeamAID
join tblTeamNames as tblTeamB on tblTeamNames.TeamID = tblGames.TeamBID

Or something close to that.

-- 
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."



More information about the thelist mailing list