Bug #30859 Mixing of comma-seperated table list and explicit join in select clause fails
Submitted: 6 Sep 2007 12:39 Modified: 6 Sep 2007 12:52
Reporter: Stefan Meier Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:5.0.45-community-log OS:Linux (Suse SLE 8, Kernel 2.4.1)
Assigned to: CPU Architecture:Any
Tags: select join

[6 Sep 2007 12:39] Stefan Meier
Description:
When mixing an comma separated list of tables and an explicit "join" clause in one SQL-Statement the column names from the first table in the select statement won't be recognized in the where clause.
In version 4.1 it works.
I'm sure no one understands what I mean by now but I hope it will be clear from the example.

How to repeat:
-- set up test tables
create table jointest1 (col1 int);
create table jointest2 (col2 int);
create table jointest3 (col3 int);

-- the following sql statement succeeds
SELECT *
FROM jointest1 
join jointest2
  on col1 = col2
JOIN jointest3
ON col1 = col3
;
--  and returns an empty set

-- the following sql statement fails
SELECT *
FROM jointest1,jointest2
JOIN jointest3
ON col1 = col3
where col1 = col2
;
-- and gives the message "ERROR 1054 (42S22): Unknown column 'col1' in 'on clause'"
-- but it
[6 Sep 2007 12:52] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Please read about "Join Processing Changes in MySQL 5.0.12" at http://dev.mysql.com/doc/refman/5.0/en/join.html