I have 4 tables; loans (has 'user_id'), users (has 'student_ID' and 'teacher_ID'), student, and teacher.
The code I tried:
SELECT *FROM loans LEFT JOIN users ON loans.user_id=users.user_id
(
IF student_ID='1' THEN (SELECT *FROM teacher)
ELSE (SELECT *FROM student)
)
The code is not working properly. I want the loans
display the student
or teacher
name from users
. I have tried similia work, and it doesn't work either.
Aucun commentaire:
Enregistrer un commentaire