题解 | #查找在职员工自入职以来的薪水涨幅情况#

查找在职员工自入职以来的薪水涨幅情况

https://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5

with temp_table_1 as (
    SELECT * FROM salaries
    WHERE (emp_no, from_date) IN (
        SELECT emp_no, MIN(from_date)
        FROM salaries
        GROUP BY emp_no
    ) 
),
temp_table_2 as (
    select * from salaries where to_date='9999-01-01'
)
select t_2.emp_no,t_2.salary-t_1.salary as growth from temp_table_2
    t_2 ,temp_table_1 t_1 where t_2.emp_no =t_1.emp_no order by growth

全部评论

相关推荐

鱼专:别投了,我看到有人点了第二个链接投递,还没退出界面,不合适的邮件就发过来了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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