select
b.emp_no,
e.first_name,
e.last_name,
b.btype,
s.salary,
case
when b.btype=1 then round(s.salary*0.1,1)
when b.btype=2 then round(s.salary*0.2,1)
else round(s.salary*0.3,1)
end as bonus
from emp_bonus b left join employees e
on b.emp_no=e.emp_no
left join salaries s
on e.emp_no=s.emp_no
where s.to_date='9999-01-01'



京公网安备 11010502036488号