Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Two Foreign Keys from the same Table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-16 : 06:46:56
ChrisH writes "I have a database which contains a table of sports teams, eg:

ID City Name
1 Atlanta Silverbacks
2 Charleston Battery
3 Richmond Kickers

I also have a table which lists the season schedule for all of these teams, eg:

ID HomeTeam AwayTeam Date
1 1 2 5/2/2001
2 3 5 5/5/2001
3 6 4 5/5/2001

I want to run a query which will display all of the fixtures in a recordset using the teams city names, (eg, Charleston @ Atlanta, Nashville @ Richmond) but I'm not sure how to approach the coding as both the HomeTeam and AwayTeam fields are foreign keys from the same table. Please help, preferably using a solution that will work both on SQL Server 2000 and Access 2000.

Thanks,
Chris"
   

- Advertisement -