+ 1
# joint sql
Please help me to solve the query with joint There are two different table, one is for students, and the other is for teacher. I would select students I’d, first name, last name, teacherid from students table. However I need to select each corresponding teacher's last name from teachers table instead of teachers id select students.id,students.firstname, students.lastname, students.teacherid as teacher from students …..how should I write more?
3 Antworten
+ 2
Go over the relevant sections of the SQL course again. They start at 18.1.
+ 4
I didn't get the schema properly from your question.
but see if any of these below are one which you are looking for.
Select students.id, students.firstname, students.lastname, teacher.name from student,teacher where students.teacherid=teachers.id;
(OR)
Select students.id, students.firstname, students.lastname, teacher.id, teacher.lastname from student,teacher;
+ 1
Thank you for the answer. Your first suggestion worked :)