Posts Tagged ‘Having Clause – MySQL’

Having Clause – MySQL

Posted: July 17, 2011 in My-SQL
Tags:

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.
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.