Thursday 22 September 2011

Explain HAVING clause in SQL Server.

The HAVING function is used in aggregate functions because WHERE keyword cannot be used in aggregate functions.

Ex :

Select EmployeeName, sum(EmployeeSalary) from Employees

Group by EmployeeName

Having Sum (EmployeeSalary) < 20000

This Query will display all the employees name , sum their salary and display if the salary is less than 20000.

Labels:


Bookmark this Blog in your Favorites

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home