Thursday, June 21, 2012

HAVING in SQL

Having is used in tandem with GROUP BY.

SELECT department, SUM(sales) as "Total sales"
FROM order_details
GROUP BY department
HAVING SUM(sales) > 1000;

No comments:

Post a Comment