select sa.employee,bo.bonusOfmonth,sa.salaryOfmonth from
(select employee,sum(bonus) as bonusOfmonth from bonustable group by employee) bo
right join
(select employee,sum(salary) as salaryOfmonth from salarytable group by employee) sa
on bo.employee=sa.employee
注:bonustable --表1
salarytable --表2
employee--姓名
bonus--奖金
salary--应发工资