喵喔喔
SQL语句中WHERE子句不能有聚合函数问题一般SQL语句中,WHERE子句是不能含有聚合函数的,否则报错:group function is not allowed here在 SQL 中增加 HAVING 子句原因是,WHERE 关键字无法与合计函数一起使用。SELECT column_name, aggregate_function(column_name)FROM table_nameWHERE column_name operator valueGROUP BY column_nameHAVING aggregate_function(column_name) operator valueSELECT Customer,SUM(OrderPrice) FROM OrdersWHERE Customer='Bush' OR Customer='Adams'GROUP BY CustomerHAVING SUM(OrderPrice)>1500