Monday, 12 August 2013

SQL Server - Foreign Key Referencing Primary Key A OR B

SQL Server - Foreign Key Referencing Primary Key A OR B

Say I have a table called Matchup that contains two sports teams. I also
have a table called Pick that has a column that must match either Team_A
OR Team_B. So it's a foreign key of one OR the other columns in Matchup.
Is this possible?
Matchup
Team_A
Team_B
Pick
Pick_Team - FK Matchup (Must match Team_A or Team_B from Matchup).

No comments:

Post a Comment