The current query gets bogged down on tab5 (wonderful name, someone should be fired for this). Without any background of what the query should do, what the data model is and some data, I can only advise to start from scratch. That means you first have to write down what answer you have to extract from the database and where the data can be found in the database. The "how are we going to do it" comes later.
↧