Jump to content

help with multipul refrence to the same table


otuatail

Recommended Posts

Hi I have a table of world cup matches. I have a field for the home team and another for the away team. The problem is both of these fields reference the same team table. I beleive you can have 2 copies of the same table as an alias. Don't know how this is done. Here is the query

 

select WorldCup.Date,WorldCup.Channel, venues.Name, teams.Name AS H,teams.Name AS A 
FROM WorldCup,venues,teams Home, teams Away WHERE venues.VenueID = WorldCup.Venue AND Home.TeamID = WorldCup.Home AND Away.TeamID = WorldCup.Away

 

TIA

 

DEsmond.

 

Solved

select WorldCup.ID,WorldCup.Date,  Home.Name AS Home, Away.Name AS Away, venues.Name AS Venue, WorldCup.Channel

FROM WorldCup,venues,teams Home, teams Away

WHERE venues.VenueID = WorldCup.Venue AND Home.TeamID = WorldCup.Home AND Away.TeamID = WorldCup.Away

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.