[WIP] MySQL JOIN bug-fix for multiple FROM tables

When using MySQL we get a “Unknown Column in On Clause” if we JOIN more tables with a reference to one of the tables in FROM.
This fixes the problem.