abc286229825
站在风口哈气
2017-05-20 12:32

关于mysql的查询问题,子查询

  • select
  • avg
  • 函数
  • mysql

这是我的查询语句:

SELECT

  • FROM departments WHERE department_id = (SELECT department_id FROM employees GROUP BY department_id HAVING AVG(salary) = (SELECT MIN(AVG(salary)) FROM employees GROUP BY department_id))

最后执行的时候,mysql报出了
错误代码: 1111 Invalid use of group function

求大神指点,该怎么改这个sql语句?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答