Tak Tak - 1 year ago 71
SQL Question

select description from another table sql

I have two tables

. Table
has 5 columns (StudentID1,StudentID2,..MatchScore), and Table
has 3 columns (StudentID, StudentName,Age).

What I'm trying to do is make a sql statement to Display: StudentName1, StudentName2, MatchScore . Any advice please?

Answer Source

You need to JOIN B table twice to get that data like

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download