Bug #91688 HAVING fails when grouping on same column name
Submitted: 18 Jul 2018 2:18 Modified: 18 Jul 2018 8:55
Reporter: Yosel Bart Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.5.57-38.9-log OS:Any
Assigned to: CPU Architecture:Any

[18 Jul 2018 2:18] Yosel Bart
Description:
When grouping by two columns with the same name, an error will be thrown if one of the columns is directly referenced from HAVING but not in the SELECT.

How to repeat:
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);

SELECT 1
FROM t1
JOIN t2
GROUP BY t1.a, t2.a
HAVING t1.a;

Error Code: 1054
Unknown column 't1.a' in 'having clause'
[18 Jul 2018 8:55] MySQL Verification Team
Hello Yosel Bart,

Thank you for the report.
This is most likely duplicate of Bug #82317, please see Bug #82317

Thanks,
Umesh