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

select t1.emp_no
,first_name
,last_name
,btype
,salary
,round((case
            when btype=1 or btype=2 then salary*(btype/10)
        else salary*0.3
        end),1) bonus
from(select b.emp_no
    ,first_name
    ,last_name
    ,btype
    from emp_bonus b left join employees using(emp_no)) t1
    join
    (select emp_no
    ,sum(salary) salary
    from salaries
    where to_date='9999-01-01'
    group by emp_no ) t2
    on t1.emp_no = t2.emp_no



全部评论

相关推荐

不愿透露姓名的神秘牛友
07-09 12:02
ssob上原来真有BOSS啊
硫蛋蛋:这种也是打工的,只不是是给写字楼房东打工
点赞 评论 收藏
分享
码农索隆:单休一个月少休息4天,一年就是48天,平时节假日,别人3天假期,单休的两天
点赞 评论 收藏
分享
一表renzha:手写数字识别就是一个作业而已
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务