Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this query:
select DE.nombre as departamento, count(H.sex) as nroHijos_Varones from hijos H 
    inner join empleado E on H.id_padre = E.id
    inner join dept DE on E.dept = DE.cod
    where H.sex = 'M' group by DE.nombre;


What I have tried:

I'm not sure if the part with inner join is fine:

E <- empleado
DE <- dept
H <- hijos

 T1 <- H ⨝_H.id=padre E ⨝_DE.cod = E.dept H 
Posted
Updated 20-May-20 21:50pm
v2
Comments
Maciej Los 21-May-20 3:50am    
How could we know that?
Note, that we don't see your screen and we can't read in your mind.

1 solution

Please, read my comment to the question first...

If you would like to know how many people with specific gender is employed in departments, use this:
SQL
select DE.nombre as departamento, H.sex, count(H.sex) as nroHijos_Varones
from hijos H 
    inner join empleado E on H.id_padre = E.id
    inner join dept DE on E.dept = DE.cod
where H.sex = 'M'
group by DE.nombre, H.sex;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900