While they accomplish a very similar function, their uses are entirely different:
First, a HAVING clause is only allowed / makes sense with a GROUP BY - which would typically imply you are using an aggregate of some sort in your SELECT statement. This also stems from the fact that in many cases aggregate functions are not allowed in the WHERE expression.
Second, the following is the order in which key expressions of your statement are executed:
Allowing the data to first be refined by the FROM and the WHERE expressions allows for certain performance improvements when using the HAVING clause on a (potentially) smaller data set.
answered Jan 18 '10 at 12:46 PM
this is very good explanation, for easy and better explanation you can visit this link http://dotnetpeoples.blogspot.com/2011/04/having-clause-vs-where-clause.html
answered Apr 21 '11 at 03:40 AM