题解 | #平均工资#
平均工资
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'