0
I have 4 tables they are already with 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 has 2 record:
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 the tables but only the columns that are related to the pupil column curso_id 1, example, a student has a course, a course has several modules, a module has several mateiras, so have to return in this order, selected student takes Administration course, then returns the modules of the Administration course and the materials of the modules.