SELECT subjects.name as name , grades.grade as grade, concat(instructors.lastname, ", ", instructors.firstname , " ", left(instructors.middlename, 1),".") as instructor
FROM subjects
JOIN grades
JOIN instructors
WHERE grades.student_id = 1 AND subjects.id = grades.subject_id AND instructors.subject_id = subjects.id
Result is
English Instructor Grade
Math Instructor Grade
But What I wanted is to give “N/A” in subjects that has no instructors yet. Example
English Instructor Grade
Math Instructor Grade
Science N/A Grade
History N/A Grade
How I am going to set a condition in my mySQL so the result will look exactly in the above example?
Thanks In Advance
TRy this ::
USing a left join and a
ifnull