Can be obtained in a single select ???
An example company, department, and production carried out
Obtain the percentage of production: the production of the person between the production of his department of his department (production person * 100 / production department
select departamento, sum(produción) from empresa group by departamento
select dni, departamento,sum(produción) from empresa group by dni,departamento