I have tried joining 3 tables(class_section, section_name, student_detail) using below query based on two selected variables:
SELECT A.cs_id
, A.class
, B.sec_id
, B.cs_id
, B.cs_name
, C.stud_id
, C.stud_class
, C.stud_section
, C.stud_adm_no
, C.stud_full_name
FROM class_section AS A
JOIN section_name as B
ON A.cs_id = b.cs_id
JOIN student_detail as c
ON C.stud_class = B.cs_id
WHERE A.cs_id = $cat
AND B.sec_id = $subcat
And now, how can I join 4 tables, 3 tables as above and 4th table is exam_schedule(ex_schedule_class,ex_schedule_section,ex_stud_id,ex_schedule_name) (where(ex_schedule_class(as relationship with cs_id in class_section ), ex_schedule_section(as relationship with sec_id in section_name) and ex_stud_id(as relationship with stud_id in student_detail) from exam_schedule table I want to retrieve the ex_schedule_name value. Please help me.