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: HAVING clause in SQL Server