关于mysql语句出现Invalid use of group function错误

782 阅读1分钟

1111 - Invalid use of group function释义:

Invalid use of group function即“集函数的无效用法”

错误例句:

SELECT AVG(chinese),math FROM student WHERE AVG(chinese) > 70 GROUP BY math

正确写法:

SELECT AVG(chinese),math FROM student GROUP BY math HAVING AVG(chinese) > 70;

image.png