hvle Posted November 10, 2009 Share Posted November 10, 2009 hi guys, couldn't think of a single query that do this: table 'team' teamID teamName 1 Sharks 2 Red Wings table 'game' gameId homeTeamId awayTeamId 100 1 2 I want a query that return 1 row like this matchId homeTeamId awayTeamId homeTeamName awayTeamName 100 1 2 Sharks Red Wings Any idea? Quote Link to comment https://forums.phpfreaks.com/topic/181048-solved-query-help/ Share on other sites More sharing options...
hvle Posted November 11, 2009 Author Share Posted November 11, 2009 select t1.idn as matchId,t1.homeTeamId,t1.awayTeamid,t2.teamName as homeTeamName, t3.teamName as awayTeamName from `game` t1 join `team` t2 on t1.homeTeamId=t2.teamId join `team` t3 on t1.awayTeamId=t3.teamId Quote Link to comment https://forums.phpfreaks.com/topic/181048-solved-query-help/#findComment-955322 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.