题解 | #查找排除当前最大、最小salary之后的员工的平均工资avg_salary#
查找排除当前最大、最小salary之后的员工的平均工资avg_salary
http://www.nowcoder.com/practice/95078e5e1fba4438b85d9f11240bc591
select avg(salary) as avg_salary
from salaries
where salary !=(select max(salary) from salaries where to_date='9999-01-01')
and salary !=(select min(salary) from salaries where to_date='9999-01-01')
and to_date='9999-01-01'
1.一开始报错点 'Operand should contain 1 column(s)',在于子查询只能返回一个值,而我填写了了max()和min()两个字段
2.第二次全部用例没有通过是因为,没有在子查询中加上to_date='9999-01-01'