select T1.*, OT.*
from Table1 as T1
inner join (
select 1 as Number, T.Col, T.Table1_ID, T.Table_ID from Table2
union all
select 2 as Number, T.Col, T.Table1_ID, T.Table_ID from Table3
) as T2 on T2.Number = T1.Number and T2.Table1_ID = T1.ID
inner join OtherTable as OT on OT.Table_ID = T2.Table_ID
或(可能效率较低)
select T1.*, OT.*
from Table1 as T1
left outer join Table2 as TMP1 on TMP1.Table1_ID = T1.ID and T1.Number = 1
left outer join Table3 as TMP2 on TMP2.Table1_ID = T1.ID and T1.Number = 2
cross apply (select isnull(TMP1.Table_ID, TMP2.Table_ID) as Table_ID) as T2
inner join OtherTable as OT on OT.Table_ID = T2.Table_ID