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.

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.