容易忘记的having
SELECT FAge,COUNT(*) AS CountOfThisAge FROM T_Employee
GROUP BY FAgeWHERE COUNT(*)>1
可以在数据库系统中执行下面的SQL的时候,数据库系统会提示语法错误,这是因为聚合函
数不能在WHERE语句中使用,必须使用HAVING子句来代替,比如:
SELECT FAge,COUNT(*) AS CountOfThisAge FROM T_Employee
GROUP BY FAge
HAVING COUNT(*)>1