Joining two separate queries.
shinacoJul 20 2007 — edited Jul 23 2007Sorry If I don't post any real code, but I can't due to security reasons.
But I have two separate queries that I would like to join.
Whenever I run them separately and use Vlookup in excel to join them, it takes a decent amount of time (about 10 min, most of the time is about waiting for all the rows to be retrieved, that means, most of the time is due to network limitations. Query 1 takes about 4 seconds to retrieve the first rows and query 2 takes about half a second).
However, If I try to join them in SQL, it takes so long that so far I haven't been able to wait until the query finishes (I have waited almost an hour and not even a single row was retrieved).
Here Is what I have tried:
1. select fields from query1, query2 where query1.key = query2.key(+)
2. Adding query2 as an additional table in the "from" section from query1 and doing the join by the key.
3. Adding the tables that query2 uses and are not present in query1 to query1, and adding all the conditions involving those tables to query1.
However, the three methods have been extremely slow. Do you have any Idea if there is a better way to do the join of two queries? Or can I force Oracle in any way to have a similar approach to the one applied when I run the separate queries and join them in Excel?
The reason I need to join them via SQL is because I need them to create a report for Oracle Discoverer.