Need help joining tables...
- by yuudachi
I am a MySQL newbie, so sorry if this is a dumb question..
These are my tables.
student table:
SID (primary)
student_name
advisor (foreign key to faculty.facultyID)
requested_advisor (foreign key to faculty.facultyID)
faculty table:
facultyID (primary key)
advisor_name
I want to query a table that shows everything in the student table, but I want advisor and requested_advisor to show up as names, not the ID numbers.
so like it displays like this on the webpage:
Student Name: Jane Smith
SID: 860123456
Current Advisor: John Smith
Requested advisor: James Smith
not like this
Student Name: Jane Smith
SID: 860123456
Current Advisor: 1
Requested advisor: 2
SELECT student.student_name, SID, student_email, faculty.advisor_name
FROM student
INNER JOIN faculty ON student.advisor = faculty.facultyID;
this comes out close, but I don't know how to get the requested_advisor to show up as a name.