I'm working with an Oracle database
I have two tables:
Student Table:
IDALUNO
IDMATRICULA
FASE
Test Table:
IDTESTE
IDALUNO
IDMATRICULA
TESTE
STATUS
I still have a view that gives me the information of the students
View Students Inquiry
IDALUNO
IDMATRICULA
NOME_ALUNO
ESCOLA
In summary, each Student can have more than one Test , and I have to build a SELECT
that returns me a Test of each Student , if there is more than one Test , I will only return the last Test entered in the system.
There is the function MAX
so I'm not sure how it would apply to my function ...
My query
looks like this:
SELECT IDTESTE, IDALUNO, IDMATRICULA, CA.NOME_ALUNO, CA.ESCOLA FROM ALUNO MA
INNER JOIN VW_CONSULTA_ALUNOS CA ON CA.IDALUNO = MA.IDALUNO
INNER JOIN TESTE MT ON MT.IDALUNO = MA.IDALUNO AND MT.IDMATRICULA = MA.IDMATRICULA