Using SQL server, I have a Table that can join with more than one table using the same column. This table has two columns, SourceType and SourceID. SourceType is the table to join with and SourceID is the primary key of the table we join to. This produces queries like this:
select *
from MyTable join TableOne
where MyTable.SourceId = TableOne.ID
and MyTable.SourceType = 'TableOne';
select *
from MyTable join TableTwo
where MyTable.SourceId = TableOne.ID
and MyTable.SourceType = 'TableTwo';
I need to do some research on this. What is this approach called?