Dołącz do wielu wierszy

SELECT l.name AS subject_name,  
  t.last_name AS student_last_name,
  st.last_name AS teacher_last_name
FROM learning AS l 
JOIN subject s ON l.subject_id=s.id
JOIN student st ON l.student_id=st.id
JOIN teacher t ON l.teacher_id=t.id;
Beautiful Boar