我有以下疑问:
select round(avg(employees.salary)) as "Average salary",
count(1) as "Number of employees",
employees.department_id as "Department ID",
departments.department_name as "Department Name"
from employees, departments
where employees.department_id = departments.department_id
group by employees.department_id, departments.department_name
order by round(avg(employees.salary)) desc;
返回的结果不符合所需的顺序。但是,当尝试使用别名“average salary”或1时,查询的效果与预期的一样。
上述查询的结果:
使用别名或号码时的结果:
为什么?
1条答案
按热度按时间yk9xbfzb1#
是的,那是个虫子。我们寻找机会,以消除成本的小组,在这种情况下,是出了问题。您可以将此作为解决方法进行提示