SELECT S.name FROM Student S WHERE S.score > 80 GROUP BY S.name Having count(*)>=2;
SELECT S.name
FROM Student S
WHERE S.score > 80
GROUP BY S.name Having count(*)>=2
没有分组的情况下having和Where 类似。
有分组的时候 Where 对分组前内容过滤,having是分组后的内容进行筛选。
having 里面可以写聚合函数,
select phone from aa group by phone having count(*) > 1
原文:https://www.cnblogs.com/anliux/p/12853016.html