+ 1
SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher FROM students, teachers WHERE students.t
What is Error in the code?
5 odpowiedzi
+ 1
Error show on the code
+ 1
Sonal Kumar
Please write / paste your code into the message body, not the title.
Your code is too long and can't show the complete code.
0
You need to add a join condition using the ON clause to indicate on which columns the tables should be joined. For instance if you have a teacher_id column in the students table that refers to the teacher's identifier in the teachers table
here is the code: SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher_lastname
FROM students
JOIN teachers ON students.teacher_id = teachers.id;
0
can you display your code? in full
What kind of error does it give you?
0
It seems like your WHERE clause is incomplete, so it's difficult to determine the exact error without knowing the full condition you intend to apply. Also the query has no join condition between the students and teachers tables, so it couldn't result in a Cartesian product (cross join) of the two tables.
You should complete the WHERE clause with a valid condition and add a proper join condition to relate the students and teachers tables