SELECT calendar.*, subjects.id, subjects.subject_name, teachers_users.full_name AS teach_name
FROM calendar, subjects, teachers_users, classes
WHERE calendar.subject = subjects.id
AND subjects.subject_teacher = teachers_users.id
AND calendar.class = classes.id
AND classes.id = '1'
GROUP BY subjects.id
SELECT
calendar.*,
subjects.id,
subjects.subject_name,
teachers_users.full_name AS teach_name
FROM calendar
JOIN subjects ON calendar.subject = subjects.id
JOIN teachers_users ON subjects.subject_teacher = teachers_users.id
WHERE calendar.class = 1;