4
I have a table tb_processos
and another tb_detalhes
(saves details of a particular process), would like to take all the data of the process and only the last detail of the process.
The way I’m doing I search all the records of tb_detalhes
related to a particular 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 take only the last record of tb_detalhes
, that is to display all process data and the desc_detalhes
of the last record entered, how can I do this?
use select limit 1.
– Marconi
@Marconi how do I limit only within JOIN? Because in the tb_process table I will show several processes.
– Bia
understood, because it does not make a Function that returns this data instead of making a Join Inner?
– Marconi
could know what you represent by
nm
, in his pattern?– Guilherme Lautert
@Guilhermelautert represents name.
– Bia