题解 | #平均工资#

平均工资

http://www.nowcoder.com/practice/95078e5e1fba4438b85d9f11240bc591

麻了是求在职人员去掉最大值和最小值的平均工资,所以只是to_data = '9999-01-01'的平均工资。。。。。。

select avg(salary) avg_salary from  
(select max(salary) max_salary,min(salary) min_salary
from salaries where to_date = '9999-01-01') s1
left join salaries s2 on  s2.salary < s1.max_salary
 and s2.salary > s1.min_salary 
 and s2.to_date  = '9999-01-01'
全部评论

相关推荐

04-17 10:16
门头沟学院 Java
不河狸啊:为什么我的是已送达,连已读都没有
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务