I'm no pro in SQL but I'm playing around with the following SELECT:
SELECT
certificate.id,
certificate.date_created,
certificate.date_approved,
certificate.notes,
certificate.id_user_student,
certificate.id_user_exm,
certificate.id_user_eval,
user.name AS student_name,
user.name AS exm_name,
user.name AS eval_name
FROM certificate
LEFT JOIN
user ON certificate.id_user_student = user.id AND
certificate.id_user_exm = user.id AND
certificate.id_user_eval = user.id
My ideia with this is to be able to take the name column from the table user and JOIN it into the certificate table for all user id fields placed.
In the table certificate the columns id_user_student, id_user_exm, id_user_eval contain user Ids available on the table user and I want to their names on the result set.
My current query only works fine for the first result. Can anyone tell me how can I fix this?
Thank you!
usertable and all them are involved in the certification process. ;)