mysql HAVING statement
Translation results:
UK['hævɪŋ] US['hævɪŋ]
n. All, holding
v. Have (the present participle of have); (in kinship relationships) accept; take; Buy
mysql HAVING statementsyntax
Function:Add the HAVING clause in SQL. The reason is that the WHERE keyword cannot be used with the total function.
Syntax: SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value GROUP BY column_name HAVING aggregate_function(column_name) operator value
mysql HAVING statementexample
//查找订单总金额少于 2000 的客户 SELECT Customer,SUM(OrderPrice) FROM Orders GROUP BY Customer HAVING SUM(OrderPrice)<2000;