2016-08-23 41 views
0

我有兩個表AB。表A有5列(StudentID1,StudentID2,.. MatchScore),表B有3列(StudentID,StudentName,Age)。從另一張表中選擇描述sql

我想要做的是使顯示的SQL語句:StudentName1,StudentName2,MatchScore。有什麼建議嗎?

+0

沒有PL/SQL在這裏,所以我建議你從主題行和標籤列表中刪除。將鼠標懸停在標籤上,以查看PL/SQL是什麼。 –

回答

1

您需要JOIN乙表兩次來獲取數據,如

select b1.StudentName as StudentName1, 
b2.StudentName as StudentName2 
from B b1 
join A a on a.StudentID1 = b1.StudentID 
join B b2 on a.StudentID2 = b2.StudentID 
相關問題