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

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

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

1.找到最后的薪资 2.找到入职时的工资 3.求差

select q1.emp_no, q1.salary - min as growth from (select emp_no, salary from salaries where to_date = '9999-01-01') q1

join

(select t1.emp_no, t1.salary as min from ( select * from salaries where emp_no in (select emp_no from salaries where to_date ='9999-01-01')) t1 join ( select emp_no,min(from_date) as mindate from salaries group by emp_no) t2 on t1.emp_no = t2.emp_no where t1.from_date = t2.mindate) q2 on q1.emp_no = q2.emp_no order by growth

全部评论

相关推荐

06-22 10:41
赣东学院 Java
程序员小白条:?周六晚上投,这是什么操作,专门找996起步的吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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