satishgaudo.com

Understanding technology

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

Bookmark and Share
Categories: Mysql
Jane at 07:19 on 1 June 2011

Wow, your post makes mine look fbeele. More power to you!

*