Why do you need to place columns you create yourself (for example select 1 as \"number\") after HAVING and not WHERE in MySQL?
select 1 as \"number\"
HAVING
WHERE
The main difference is that WHERE cannot be used on grouped item (such as SUM(number)) whereas HAVING can.
SUM(number)
The reason is the WHERE is done before the grouping and HAVING is done after the grouping is done.