Details
Description
For mariadb 10.1.21
Create two tables for test:
mysql> create table t1 (c1 int, c2 int); |
Query OK, 0 rows affected (0.08 sec) |
|
mysql> create table t2 (c1 int, c2 int); |
Query OK, 0 rows affected (0.04 sec) |
Then test the following sqls:
mysql> select t1.c1 as c1 , t2.c2 as c1 from t1, t2 where t2.c2 > 5 having t1.c1 < 3; |
Empty set (0.00 sec) |
|
mysql> select t1.c1 as c1 , t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 having t1.c1 < 3; |
Empty set (0.00 sec) |
|
mysql> select t1.c1 as c1 , t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1 , t2.c2 having t1.c1 < 3; |
ERROR 1052 (23000): Column 't1.c1' in having clause is ambiguous |
Why the sql1 and sql2 can pass, but the sql3 fail due to "having clause is ambiguous"?
The sql3 can pass for mariadb 10.0.27.