我有2種表貨幣和對有以下字段,的Sybase查詢多個外鍵指向一個主鍵
貨幣
Currencies_ShortName
Currencies_Id(主鍵)
成對
Pairs_ShortName
Currencies_Id_1參考(貨幣)Currencies_Id
Currencies_Id_2參考(貨幣)Currencies_Id
我想顯示Pairs_ShortName,Currencies_Id_1 & Currencie帶有Currencies_ShortName的s_Id_2。
我試圖
Select a.Pairs_ShortName, a.Currencies_Id_1, a.Currencies_Id_2, b.Currencies_ShortName from Pairs a, Currencies b where a.Currencies_Id_1 = .Currencies_Id
但它只顯示Pairs_ShortName,Currencies_Id_1,Currencies_ShortName。
我想顯示Pairs_ShortName,Currencies_Id_1,Currencies_ShortName,Currencies_Id_2,Currencies_ShortName
爲什麼您的Pairs表中有兩個貨幣ID外鍵?你想在這裏做什麼?你的Pairs桌子上有主鍵嗎?您在where子句中缺少'b'前綴,即b.Currencies_Id。 – Alicia