题解 | #获取有奖金的员工相关信息。#
获取有奖金的员工相关信息。
http://www.nowcoder.com/practice/5cdbf1dcbe8d4c689020b6b2743820bf
很容易的一个知识交叉运用
select a.emp_no,a.first_name,a.last_name,b.btype,c.salary, (case when btype = 1 then c.salary * 0.1 when btype = 2 then c.salary * 0.2 else c.salary * 0.3 end ) as bonus from employees a left join emp_bonus b on a.emp_no = b.emp_no left join salaries c on a.emp_no = c.emp_no where b.btype is not null and c.to_date = '9999-01-01';