with tb1 as(
select emp_no, salary
from salaries
where to_date='9999-01-01')
select emp_no, first_name, last_name, btype, salary,
case when btype=1 then round(0.1*salary,1)
when btype=2 then round(0.2*salary,1)
else round(0.3*salary,1) end as bonus
from tb1 right join emp_bonus using(emp_no)
left join employees using(emp_no)
order by tb1.emp_no



京公网安备 11010502036488号