|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-10-20 : 15:42:07
|
Gurd writes "OK,
The two tables in question are detailed below; 1st table name: teams columns: teamid, name e.g data: 01, TeamA; 02, TeamB; 03, TeamC; 04, Team; etc
2nd table name: fixtures columns: fixid, monthid, day, hometeamid, awayteamid, result e.g data 01, 04, 20, 01, 02, draw; 02, 04, 20, 03, 04, home win; 03, 05, 27, 04, 01, draw; etc
So the basic idea is I would like to display all the fixtures from the fixtures table but with the hometeamid and awayteamid both replaced with their real team names from the teams table. I can get my sql query to display either the home team name or away but not both, ie using fixid 1;
01, April, 20th, TeamA, 02, draw;
my sql so far is SELECT f.fixid, f.monthid f.day, t.name AS Home_Team, f.awayteamid AS Away_Team, f.result FROM fixtures f, teams t WHERE t.teamid = f.hometeamid
assistance much appreciated
regards Gurd " |
|