HAVING Clause
The HAVING clause was added to SQL because the WHERE clause could not be used with aggregate functions.
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
Example:
SELECT customer,SUM(orderprice) FROM trans_orders
GROUP BY customer
HAVING SUM(orderprice)<1000
Categories: Mysql
Wow, your post makes mine look fbeele. More power to you!