Imagine table with two columns (there are more, but not relevant anyhow to this question):
`EAN` bigint(20) unsigned DEFAULT NULL,
`parameter_id` mediumint(8) unsigned DEFAULT NULL,
This query does not work and returns error:
SELECT EAN FROM eTovar WHERE EAN GROUP BY EAN HAVING parameter_id IS NULL
Error in query (1054): Unknown column 'parameter_id' in 'having clause'
But this query works:
SELECT EAN FROM eTovar WHERE EAN GROUP BY EAN HAVING MIN(parameter_id) != MAX(parameter_id)
I assume that for some reason, HAVING is able to reach MIN(parameter_id) but unable to reach clean parameter_id. Why?
I have MariaDB 5.5 (should be same as MySQL 5.5).