题解 | #获取有奖金的员工相关信息。#

获取有奖金的员工相关信息。

http://www.nowcoder.com/practice/5cdbf1dcbe8d4c689020b6b2743820bf

select eb.emp_no, e.first_name, e.last_name, eb.btype, s.salary, 
        round(s.salary * (case eb.btype 
                            when 1 then 0.1
                            when 2 then 0.2 
                            else 0.3
                            end), 1) bonus
from employees as e 
    join salaries as s on e.emp_no = s.emp_no 
    join emp_bonus as eb on eb.emp_no = s.emp_no and eb.recevied <= s.to_date and eb.recevied >= s.from_date
order by emp_no asc 

全部评论
select e.emp_no,e.first_name,e.last_name,eb.btype,s.salary, case btype when 1 then round(salary*0.1,1) wnen 2 then round(salary*0.2,1) else round(salary*0.3,1) end as bonus from employees e join salaries s on e.emp_no=s.emp_no join emp_bonus eb on eb.emp_no=e.emp_no where to_date='9999-01-01' order by e.emp_no asc; 我在case里的then后面用round为什么总是报错啊?
点赞 回复 分享
发布于 2023-07-17 15:24 湖北

相关推荐

Freewho:哈哈哈你一句不是我兄弟给HR都干蒙了,以为东子附体了呢哈哈哈
点赞 评论 收藏
分享
7 收藏 评论
分享
牛客网
牛客企业服务