- I have to consult 4 tables of a database in mysql
- From 3 tables I need to take all the information with a where
- Of the fourth only take the last record that was entered in the column.
I have the following code
SELECT convenio.nit_Fuente, fuentes.nom_Fuente, convenio.nit_asociado, asociados.Nom_asociado, asociados.Apell_asociado
FROM 'convenio'
LEFT JOIN 'fuentes' ON (convenio.nit_Fuente = fuentes.nit_Fuente)
LEFT JOIN 'asociados' ON (convenio.nit_asociado = asociados.nit_asociado)
LEFT JOIN (SELECT recibo.num_recibo, MAX(recibo.num_recibo
FROM recibo )
WHERE convenio.nit_asociado = '101244561'