fix SQLQueryTest for joins and table renaming