What is the difference between HAVING and WHERE in an SQL SELECT statement?
EDIT: I have marked Steven’s answer as the correct one as it contained the key bit of information on the link:
When
GROUP BYis not used,HAVINGbehaves like aWHEREclause
The situation I had seen the WHERE in did not have GROUP BY and is where my confusion started. Of course, until you know this you can’t specify it in the question.
Advertisement
Answer
HAVING specifies a search condition for a group or an aggregate function used in SELECT statement.