having必须和group by一起使用
SELECT Country
from Customers
GROUP BY Country #且必须在group by的后面
HAVING COUNT(country)> 2;
having后面必须接Aggregate 函数
例如:如下sql语句会报如下错误,改成HAVING count(CustomerID)>2即可
SELECT Country
from Customers
GROUP BY country
HAVING CustomerID>2
having必须和group by一起使用
SELECT Country
from Customers
GROUP BY Country #且必须在group by的后面
HAVING COUNT(country)> 2;
having后面必须接Aggregate 函数
例如:如下sql语句会报如下错误,改成HAVING count(CustomerID)>2即可
SELECT Country
from Customers
GROUP BY country
HAVING CustomerID>2