Possible Duplicate:
SQL: What's the difference between HAVING and WHERE?
I have seen various discussions on WHERE
and HAVING
. I still have a question: is HAVING
used only when considering aggregates, or can it be used in more general terms: whenever you have created or aliased a field in your query?
I know that WHERE
should always be used when possible.
HAVING
specifies a search for something used in the SELECT
statement.
In other words.
HAVING
applies to groups.
WHERE
applies to rows.