I have a table tb_processos
and another tb_detalhes
(it keeps details of a certain process), I would like to get all the process data and only the last detail of the process.
The way I'm doing I search for all records of tb_detalhes
related to a given process:
SELECT
tb_processo.nm_empresa,
tb_processo.dt_solicitacao,
tb_detalhes.desc_detalhes
FROM
tb_processo
LEFT JOIN tb_detalhes ON tb_detalhes.id_processo = tb_processo.id_processo
However, I would like to get only the last record of tb_detalhes
, ie I will display all the data in the process and the desc_detalhes
of the last record entered, how can I do this?