The query is too complex. Reduce the number of fields in the SELECT clause or the number of subqueries or tables in the join.