-1017: Too many joins

Explanation:

The number of JOIN predicates in a search condition cannot exceed 64 (see Restrictions for SQL Statements).

User Action:

The expected result can be achieved by issuing several QUERY statements and creating the respective result tables as temporary results. It is also possible to change the SQL statement in such a way that temporary results are implicitly created when a QUERY expression is used in a FROM clause.