Share on Facebook Share on Twitter Email
Answers.com

Having

 
Wikipedia: Having (SQL)

A HAVING statement in SQL specifies that an SQL SELECT statement should only return rows where aggregate values meet the specified conditions. It was added to the SQL language because the WHERE keyword could not be used with aggregate functions.[1]

Examples

Returns a list of Department IDs whose total sales exceeded $1000 on the date of January 1, 2000, along with the sum of their sales on that date.

 SELECT DeptID, SUM(SaleAmount)
 FROM Sales
 WHERE SaleDate = '01-Jan-2000'
 GROUP BY DeptID
 HAVING SUM(SaleAmount) > 1000

External links

References


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
Shopping: Having
Top
 
 

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Having (SQL)" Read more