Hi,
I must admit that I didn't fully understand the question, but if you want to get a sum for detail rows based on gender in Employee your query could be something like:
select e.gender,
sum(d.comission)
from employee e,
detail d
where e.id = d.id
group by e.gender;
Use the correct joining fields in the where-clause.