问题描述
为什么在我想查询成绩(score)表中不及格(num < 60)的学生的ID(student_id),不能使用having select student_id from score having num < 60;
只能使用select student_id from score where num < 60
;
问题出现的环境背景及自己尝试过哪些方法
mysql5.7
报错信息
期望
我想知道其中报错的原理
为什么在我想查询成绩(score)表中不及格(num < 60)的学生的ID(student_id),不能使用having select student_id from score having num < 60;
只能使用select student_id from score where num < 60
;
mysql5.7
我想知道其中报错的原理
4 回答1.5k 阅读✓ 已解决
8 回答1.3k 阅读
3 回答918 阅读✓ 已解决
3 回答1.1k 阅读✓ 已解决
2 回答1.6k 阅读
2 回答1.8k 阅读
1 回答894 阅读✓ 已解决
having 是对返回结果进行过滤,返回结果中没有num,你在返回结果中加上num就能过滤了
正确理解MySQL中的where和having的区别https://blog.csdn.net/yexuden...