程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SqlServer數據庫 >> 關於SqlServer >> SQL: HAVING Clause

SQL: HAVING Clause

編輯:關於SqlServer
The HAVING clause is used in combination with the GROUP BY clause. It can be used in a SELECT statement to filter the records that a GROUP BY returns.
譯:HAVING子句是與GROUP BY子句聯合使用。能夠用於SELECT語句中用於篩選由GROUP BY返回的結果。
The syntax for the HAVING clause is:
SELECT column1, column2, ... column_n, aggregate_function (expression)
FROM tables
WHERE predicates
GROUP BY column1, column2, ... column_n
HAVING condition1 ... condition_n;

aggregate_function can be a function such as SUM, COUNT, MIN, or MAX.
譯:aggregate_function可以是SUM, COUNT, MIN, or MAX函數。
Example using the SUM function
For example, you could also use the SUM function to return the name of the department and the total
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved