Mapping Table
Desciption ToID FromID
Map A 2 1
BaseTable
Id, Deccription, subTypeID
1 ValueA 9
2 ValueB 10`enter code here`
SubTypeTable
id Description
9 SubType 9
10 Subtype 10
我要返回的是映射表中的以下内容
MapDescription、ToID 的 SubTpeDescription、FromID 的 SubTpeDescription
所以基本上 MapA,Subtype9,Subtype 10 作为输出
我到目前为止所做的是
Select m.Description, st.Description from Mapping m
right join BaseTable bt where m.toID = bt.id
right join BaseTable bt where m.FromID = bt.id,
inner join SubTypeTable stt on bt.subTypeID = stt.id