总结了两种写法:一种用case when then end,另一种用if(condition,true,false)
方法一:
select e.emp_no,first_name,last_name,btype,salary,(0.1salary(if(btype>2,3,btype)))
from employees e,emp_bonus eb,salaries s
where e.emp_no=eb.emp_no and e.emp_no=s.emp_no and to_date='9999-01-01'
方法二:
select e.emp_no,first_name,last_name,btype,salary,(case btype when 1 then 0.1btypesalary when 2 then 0.1btypesalary else 0.3*salary end)
from employees e,emp_bonus eb,salaries s
where e.emp_no=eb.emp_no and e.emp_no=s.emp_no and to_date='9999-01-01'