Bug #82317 | Unrelevant error message: Unknown column in 'having' clause | ||
---|---|---|---|
Submitted: | 22 Jul 2016 7:42 | Modified: | 22 Jul 2016 15:02 |
Reporter: | Dmitry Savchenkov | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | 5.5.49 | OS: | Any (v14.04.1) |
Assigned to: | CPU Architecture: | Any | |
Tags: | groupby, having |
[22 Jul 2016 7:42]
Dmitry Savchenkov
[22 Jul 2016 8:00]
Dmitry Savchenkov
Remove exact column name from synopsis
[22 Jul 2016 15:02]
MySQL Verification Team
I have tried latest 5.6 and 5.7 version and I get the same error: ERROR 1054 (42S22) at line 8: Unknown column 'code2tmp.ext_id' in 'having clause' with a very similar test case: CREATE TABLE IF NOT EXISTS `t1` ( `id` INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ); INSERT INTO t1 (`id`) VALUES (NULL); CREATE TABLE IF NOT EXISTS `t2` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `t1_id` INT(11) NOT NULL, `ext_id` INT(11) NOT NULL, `code` VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO t2 (`id`, `t1_id`, `ext_id`, `code`) VALUES (NULL, 1, 1, 'code1'); INSERT INTO t2 (`id`, `t1_id`, `ext_id`, `code`) VALUES (NULL, 1, 1, 'code2'); SELECT t1.id FROM t1 LEFT JOIN t2 AS code1tmp ON t1.id = code1tmp.t1_id AND code1tmp.code = 'code1' LEFT JOIN t2 AS code2tmp ON t1.id = code2tmp.t1_id AND code2tmp.code = 'code2' GROUP BY code2tmp.ext_id, code1tmp.ext_id HAVING code2tmp.ext_id = MIN(1); DROP TABLE IF NOT EXISTS t1; DROP TABLE IF NOT EXISTS t2;
[18 Jul 2018 8:55]
MySQL Verification Team
Bug #91688 marked as duplicate of this one