1
First of all, this is the code that I’m trying to sum up the products of each lab and display
select l.razaosocial, sum(p.quantidade) from produto p
inner join laboratorio l on p.fk_laboratorio_id = l.id_laboratorio;
Only the result is the SUM of all products regardless of which registered supplier, and returning the first registered supplier.
I wanted something that would return which supplier most supplies products, with the quantity and his name in the case, social reason....