Answer the question
In order to leave comments, you need to log in
Why do aliases from SELECT work in HAVING?
I read that column aliases cannot be used in the WHERE clause because the query is processed according to the scheme:
Answer the question
In order to leave comments, you need to log in
HAVING is intended for post-filtering data, not for primary. One of the main reasons why it is written after GROUP BY. Due to GROUP BY, you have calculated fields by the functions GROUP_CONCAT, MAX, MIN, SUM, ... Filtering by these calculated fields is performed by HAVING.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question