After upgrading a mysql from 4.1 to 5.6 (with no problems), the problems come when trying to execute the queries:
SELECT *
FROM table1, anothertable
LEFT JOIN thirdtable ON table1.id=thirdtable.id
AND thirdtable.town=anothertable.town
WHERE table1.id=8 and anothertable.id=table1.id;
ends in the error message:
Unknown column ‘table1.id’ in ‘on clause’
The same query worked perfectly on 4.11. – any hints what to do, to make the queries work again?
The problem is: there are a lot of queries to rewrite – and they are more complex then the example (which is stripped down to the problem). So it would be nice to find a mysql-server solution.
Thanks for any hints.
There is no “natural join” in your query.
You are mixing explicit joins (JOIN … ON) and implicit joins (WHERE anothertable.id=table1.id) in the same query which is a very bad habit to begin with.
You should (and apparently have to) re-write the query to only use explicit joins.
You should revisit the “several reasons” that don’t allow you to rewrite the queries. It is really a bad idea to keep the queries as they are.