2
I’m working with an Oracle bank
I have two tables:
Table Student:
IDALUNO
IDMATRICULA
FASE
Test Table:
IDTESTE
IDALUNO
IDMATRICULA
TESTE
STATUS
I also have a view that gives me the information of the students
View Students Consultation
IDALUNO
IDMATRICULA
NOME_ALUNO
ESCOLA
In summary, each Pupil may have more than one Testing, and I have to build a SELECT
that returns me a Testing of each Pupil, if there is more than one Testing, I will return only the last Testing embedded in the system.
There is the function MAX
I’m just not sure how I’d apply myself to this job...
My query
is 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
I can do this within a subquery from an Inner Join?
– MarceloBoni
@Marcelobonifazio I didn’t understand the question. Did the query work? Do you want it to look different?
– Caffé
Gave straight @Caffé, I had tried to do another way, only there would involve
group by
and would end up leaving a gambiarra, this way was much more efficient– MarceloBoni