题解 | 获取有奖金的员工相关信息。
获取有奖金的员工相关信息。
https://www.nowcoder.com/practice/5cdbf1dcbe8d4c689020b6b2743820bf
select *, case when btype = 1 then (salary)*0.1 when btype = 2 then (salary)*0.2 when btype = 3 then (salary)*0.3 end as bonus from( select t1.emp_no, t1.first_name, t1.last_name, t2.btype, t3.salary from employees as t1 inner join emp_bonus as t2 inner join salaries as t3 on t1.emp_no = t2.emp_no and t1.emp_no = t3.emp_no where t3.to_date = '9999-01-01') as t4