I have 4 tables they already have foreign key.
aluno:
id
matricula
username
curso_id // referencia a id_cursos da tabela cursos, coluna id_cursos.
cursos:
id_cursos
nome_cursos
modulos:
id_modulos
nome_modulos
cursos_id //faz referencia a tabela cursos, coluna id_cursos.
materias:
id_materias
nome_materias
modulos_id // faz referencia a tabela modulos, coluna id_modulos.
in the student table you have 2 records:
id | matricula | username | curso_id.<br>
1 | 12345678 | Usuario1 | 1
id | matricula | username | curso_id.<br>
2 | 12344321 | Usuario2 | 2
I want to return all tables but only the columns that are related to the student column course_id 1, example, a student has a course, a course has several modules, a module has several fields, then has to return in this order, selected student makes Administration course, then returns the modules of the Administration course and the subjects of the modules.