What is the Difference Between WHERE and HAVING Clauses in SQL Server
» July 3, 2010 |
Labels:
Differences,
SQL Server,
T-SQL
|
Qns by Labels |
|||||||
- HAVING clause can be used only with a GROUP BY clause, where as a WHERE clause can be used with constructs like SELECT, UPDATE, DELETE etc.
- HAVING clause is applied as a filter to the data / output resulting from the GROUP BY clause, where as a WHERE clause is applied to every row in the SELECT, UPDATE, DELETE etc constructs.
- In queries where both HAVING and WHERE clauses are used, WHERE clause is applied first (to every row in the SELECT statement to filter the records before they are fed to GROUP BY clause for aggregation) and then the HAVING clause is applied (to filter the aggregated result from GROUP BY clause).
2 comments:
Great Blog Thanks.
Here You Can Find Your First Round Intreview question For Job .
SSRS interview questions
Thanks for sharing the best informative article....Am got the best information in this article..keep Sharing..
MSBI Demand
Post a Comment