Bug #36857 | table alias - unknown in on-clause when using table-aliases other than the last | ||
---|---|---|---|
Submitted: | 21 May 2008 16:48 | Modified: | 21 May 2008 17:42 |
Reporter: | Thomas Wittich | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | 5.1.11 & 5.0.44 | OS: | Any (Linux as well Win XP Prof SP2) |
Assigned to: | CPU Architecture: | Any | |
Tags: | join, on-clause, sql-parser, table alias, usage |
[21 May 2008 16:48]
Thomas Wittich
[21 May 2008 17:42]
MySQL Verification Team
Thank you for the bug report. Please read the Manual regarding Join syntax changes from version 5.0.13 to be more sql standard. Thanks in advance. c:\dbs>5.0\bin\mysql -uroot test Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.62-nt Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> DROP TABLE IF EXISTS `test`.`t1`; Query OK, 0 rows affected (0.00 sec) mysql> CREATE TABLE `test`.`t1` ( -> `id` int(10) unsigned NOT NULL auto_increment, -> PRIMARY KEY (`id`) -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; Query OK, 0 rows affected (0.09 sec) mysql> mysql> DROP TABLE IF EXISTS `test`.`t2`; Query OK, 0 rows affected (0.00 sec) mysql> CREATE TABLE `test`.`t2` ( -> `id` int(10) unsigned NOT NULL auto_increment, -> PRIMARY KEY (`id`) -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; Query OK, 0 rows affected (0.06 sec) mysql> mysql> DROP TABLE IF EXISTS `test`.`t3`; Query OK, 0 rows affected (0.02 sec) mysql> CREATE TABLE `test`.`t3` ( -> `id` int(10) unsigned NOT NULL auto_increment, -> PRIMARY KEY (`id`) -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; Query OK, 0 rows affected (0.08 sec) mysql> mysql> DROP TABLE IF EXISTS `test`.`t3`; Query OK, 0 rows affected (0.00 sec) mysql> CREATE TABLE `test`.`t3` ( -> `id` int(10) unsigned NOT NULL auto_increment, -> PRIMARY KEY (`id`) -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; Query OK, 0 rows affected (0.05 sec) mysql> mysql> select a.id,b.id,c.id -> from t1 a, t2 b -> left join t3 c on a.id = c.id; ERROR 1054 (42S22): Unknown column 'a.id' in 'on clause' mysql> select a.id,b.id,c.id -> from (t1 a, t2 b) -> left join t3 c on a.id = c.id; Empty set (0.00 sec)