Make a select with 3 tables and return in table 3 the records of the id of the first [duplicate]

-1

I have 3 tables, the first is occurrence, second is the individuals and third vehicles. The tables individuals and vehicles I made subforms of occurrences. I have the first key in the instance id_current, the other tables I have the primary key of them and the foreign keys linked to occurrences. I want in the table vehicles that have a field that shows the names of the individuals related to the occurrence, it has to be the individuals that just registered or it is of the same occurrence (id).

    
asked by anonymous 07.05.2018 / 22:22

1 answer

0

According to the comment:

SELECT i.nome, MAX(o.id_ocorrencia) FROM individuo i
LEFT JOIN ocorrencia as o ON i.id_ocorrencia_ind = o.id_ocorrencia
GROUP BY i.nome;
    
07.05.2018 / 22:40