You might run in to the following problem with a MySQL 5 installation.
SELECT *
FROM table1, table2
INNER JOIN table3 on table1.columnname = table3.columnname;
> #1054 – Unknown column ‘table1.columnname’ in ‘on clause’
While that would have been a valid query for previous MySQL versions, there is now a requirement to add round brackets around the tables you want to select through a “FROM”-clause.
Change the query to the following, and it will work again.
SELECT *
FROM (table1, table2)
INNER JOIN table3 on table1.columnname = table3.columnname;
You will most likely see this behaviour when upgrading from a MySQL4 to a MySQL5 environment, and it’s a b*tch to track this one down. The following bug reports were also made on MySQL, which might prove useful to you should the above not work.
- Bug #1689: Unknown column in ‘field list’ for a field that does exist
- Bug #13551: #1054 – Unknown column ‘xxxx’ in ‘on clause’
- Bug #13597: Column in ON condition not resolved if references a table in nested right join