I have the following code that gives me a table like the one in the picture, but my question is how do I get the name and just the name of the one that has the highest health value that will be the gas? Is it possible to use a NOT EXISTS in this case?
SELECT O.nome, SUM(E.saude)
FROM Objecto O, Elemento E, composto C
WHERE O.marca = C.prodMarca AND C.produto = O.codigo AND C.elemento = E.codigo
GROUP BY O.nome