Good morning friends, I have the following query:
SELECT
i.cod_modular, a.idarchivo, m.descripcion, m.cantidad as cantidades,
d.matriculados, (m.cantidad - d.matriculados) as deficit
FROM archivo a
JOIN iiee i on i.cod_modular = a.iiee_cod_modular
JOIN mobiliario m on m.archivo_idarchivo = a.idarchivo
JOIN detalle d ON d.archivo_idarchivo = a.idarchivo
WHERE m.descripcion like "%silla%" ORDER by a.idarchivo ASC
Which gives me the following result:
How can I add the amounts of the chairs only of the idarchivo
with the highest value of cod_modular
?
I hope your help, greetings :)